Skip to content

pgdeadbolt

Stop AI coding agents from shipping Postgres migrations that lock your tables.

A migration that finishes instantly on your laptop can freeze a busy table in production. CREATE INDEX without CONCURRENTLY blocks every write for the whole build. A column with DEFAULT gen_random_uuid() rewrites the table. Coding agents write these all the time, because they’re correct SQL.

Terminal window
npx pgdeadbolt check migrations/
Migration on 2M rows Build time Writes blocked
CREATE INDEX 2.48s 2.48s
CREATE INDEX CONCURRENTLY 2.59s 33ms

Catches it

16 rules, built on Postgres’s own parser, know which lock each statement takes and print the safe way to make the same change.

Measures it

rehearse runs the migration on a throwaway Postgres under live probes and reports how long writes and reads were actually blocked.

Guards your agent

A Claude Code plugin checks every migration the agent writes and hands back the fix. Codex, Cursor and a GitHub Action are covered too.

Fits your stack

Plain SQL, Prisma, Drizzle, Supabase, Rails, Django and Knex. Exit codes, JSON, GitHub annotations and SARIF for CI.