warning
free in the CLI
Unbounded UPDATE or DELETE
Warning — this works, but blocks traffic or rewrites data at scale.
What it catches
A WHERE-less UPDATE/DELETE rewrites or removes every row in a single transaction: it locks all rows for the duration, doubles the table in dead tuples, floods WAL, and stalls replicas. Backfills belong in batched jobs, not migrations.
Fires on
UPDATE orders SET region = 'eu';Do this instead
Move the backfill to a batched job: update or delete a bounded set per transaction, commit, repeat until done. Each batch releases its row locks, keeps dead-tuple churn vacuumable, and lets replicas keep up — and a failure resumes instead of rolling back hours of work.
-- From a job, not a migration — bounded batches, commit each:
-- UPDATE orders SET region = 'eu'
-- WHERE id IN (SELECT id FROM orders WHERE region IS NULL LIMIT 5000);
-- loop until 0 rows updatedCatch this before it ships
This rule runs locally in the free CLI — or with the full corpus through the hosted service: npx bolvrk check migration.sql