Migration contract
Static analysis of Postgres migration SQL. Flags statements that acquire dangerous locks before they reach production.
Rules (MVP)
| Pattern | Severity | Risk |
|---|---|---|
CREATE INDEX without CONCURRENTLY | high | Write blocking on large tables |
ADD COLUMN ... NOT NULL (one-step) | high | Full table rewrite |
SET NOT NULL | high | Validation lock |
DROP TABLE / TRUNCATE | high | Destructive |
VACUUM FULL | high | Exclusive lock |
Config
version: 1
contracts:
- type: migration
paths:
- prisma/migrations/**/*.sql
severity: high
fix: "Use CREATE INDEX CONCURRENTLY and multi-step NOT NULL backfills."
Or use a dedicated prodverdict.migration.yml for migration-only CI jobs.
CLI
npx prodverdict check migration --config prodverdict.migration.yml
npx prodverdict check migration --repo-root .
Fixtures
SDK examples include migrations/unsafe/ and migrations/safe/ for demo runs.
Live pg_table_size blast-radius scoring is planned for a future release.