Skip to main content

Migration contract

Static analysis of Postgres migration SQL. Flags statements that acquire dangerous locks before they reach production.

Rules (MVP)

PatternSeverityRisk
CREATE INDEX without CONCURRENTLYhighWrite blocking on large tables
ADD COLUMN ... NOT NULL (one-step)highFull table rewrite
SET NOT NULLhighValidation lock
DROP TABLE / TRUNCATEhighDestructive
VACUUM FULLhighExclusive 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.