Squawk — a linter for Postgres migrations

1 min read Original article ↗
rule namedescriptionadding-field-with-defaultPrevent blocking reads/writes to table while table is rewritten on PG < 11.adding-foreign-key-constraintPrevent blocking writes to tables while verifying foreign key constraint.adding-not-nullable-fieldPrevent blocking reads/writes to table while table is scanned on PG < 11.adding-serial-primary-key-fieldPrevent blocking reads/writes to table while index is built.changing-column-typePrevent breaking existing clients that depend on column type. Prevent blocking reads/writes to table while table is rewritten.constraint-missing-not-validPrevent blocking writes to the table while the scan occurs.disallowed-unique-constraintPrevent blocking reads/writes to table while index is built.prefer-robust-stmtsEnsure migrations are atomic or retriable.prefer-text-fieldPrevent blocking reads and writes to table while table metadata is updated.require-concurrent-index-creationPrevent blocking writes to table while index is created.require-concurrent-index-deletionPrevent blocking reads/writes to table while index is dropped.transaction-nestingEnsure migrations use transactions correctly.ban-create-domain-with-constraintDomains with constraints have poor support for online migrationsban-alter-domain-with-add-constraintDomains with constraints have poor support for online migrationsrequire-timeout-settingsRequire lock and statement timeouts