ALTER SYSTEM in a migration
Critical — this fails outright or takes production down.
What it catches
ALTER SYSTEM edits the server's configuration for every database and every connection, persists in postgresql.auto.conf far beyond the migration, cannot run inside a transaction block, and usually needs a reload or restart to even take effect. Nothing about it is schema — it is cluster administration in migration clothing.
Fires on
ALTER SYSTEM SET max_connections = 500;Do this instead
Change server configuration through your infrastructure's configuration management (or an operator runbook), where it is reviewed as what it is: a cluster-wide operational change with a reload/restart step. Migrations should only ever touch schema.
-- Cluster configuration is an operational change, not schema history:
-- ALTER SYSTEM SET max_connections = 500; -- run by an operator
-- SELECT pg_reload_conf(); -- and reloaded deliberately
-- or better: set it in your managed-Postgres / config-management layer 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