note
hosted, paid — --remote
Repeated ALTER TABLE statements on the same table
Note — this works and blocks nothing, but a performance regression is likely.
What it catches
Each ALTER TABLE statement acquires its own ACCESS EXCLUSIVE lock — queueing behind traffic every single time. One ALTER TABLE with comma-separated actions acquires the lock once and does all the work under it.
Fires on
ALTER TABLE orders ADD COLUMN a text;
ALTER TABLE orders ADD COLUMN b text;Do this instead
Combine the actions into one ALTER TABLE statement with comma-separated subcommands: one lock acquisition, one queue traversal, all the work done under it.
SET lock_timeout = '5s';
ALTER TABLE orders
ADD COLUMN a text,
ADD COLUMN b text;Catch this before it ships
This rule runs in the hosted service on Startup and above — add --remote with a team token, or use the GitHub Action: npx bolvrk check migration.sql