Private
Public Access
One migration did a full-table UPDATE, a blocking GIN build and the trigger install together — long locks and a deploy that could outlast its health-check window on a large archive. Now two stages. 0002 only adds the nullable column and the trigger (metadata-only; new and updated rows get a vector from then on). 0003 is non-atomic: it backfills in 5,000-id batches, each its own short transaction and only touching rows still NULL, then builds the index with CREATE INDEX CONCURRENTLY (dropping a stale INVALID one from a failed earlier run first). Re-running is safe, and it's a cheap no-op on an install that applied the earlier single-step version. Measured on a real PostgreSQL 16 with 150,000 existing articles while a second connection kept inserting/updating: the migration took ~20s, the slowest concurrent write was 37ms (nothing blocked), no NULL vectors remained, the index was valid, and unapply/re-apply worked. Full suite passes on Postgres. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>