Skip to main content

max / makenotwork

Revert errant comment edit to already-applied migration 152 5716d14 expanded the comment in 152_cover_s3_key_backfill.sql (SQL byte-for- byte unchanged), but sqlx checksums the whole file, so any DB that already applied the original — prod at 0.10.6, and testnot's daily prod-refresh — rejects boot with "migration 152 was previously applied but has been modified". Restore the original file so the checksum matches what's deployed. Never edit an applied migration, even comments. (Latent prod blocker too.) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author: Max Johnson <me@maxj.phd> · 2026-07-08 23:44 UTC
Commit: 5539cc28ddc02f4b90b84f9746102aa3cd0ab44a
Parent: 9ee146b
1 file changed, +4 insertions, -8 deletions
@@ -13,14 +13,10 @@
13 13 ALTER TABLE projects ADD COLUMN IF NOT EXISTS cover_s3_key TEXT;
14 14
15 15 -- Backfill from the canonical URL form: strip scheme + host (and any query
16 - -- string) to recover the object key. Stored cover URLs are `{cdn_base}/{s3_key}`,
17 - -- so the path after the host IS the key. This holds because production REQUIRES
18 - -- a CDN (Config::from_env returns MissingCdnBaseUrl otherwise, ultra-fuzz Run 10
19 - -- Sto S-1); the no-CDN dev fallback stores path-style presigned URLs
20 - -- (`{endpoint}/{bucket}/{key}`) that this regex would mis-key, but that mode is
21 - -- not allowed in production where this backfill runs. Only touch rows that have a
22 - -- URL but no key yet; a URL that isn't an http(s) path with a non-empty path is
23 - -- left NULL (nothing for the worker to protect).
16 + -- string) to recover the object key. Stored cover URLs are always
17 + -- `{cdn_base}/{s3_key}`, so the path after the host IS the key. Only touch rows
18 + -- that have a URL but no key yet; a URL that isn't an http(s) path with a
19 + -- non-empty path is left NULL (nothing for the worker to protect).
24 20 UPDATE projects
25 21 SET cover_s3_key = substring(cover_image_url from '^https?://[^/]+/([^?]*)')
26 22 WHERE cover_image_url IS NOT NULL