A Claude Code skill that catches schema-migration mistakes before they run.
Catches the migration mistakes that cause production incidents — blocking locks on hot tables, silently irreversible drops, and deploy-ordering breakage — before the migration runs, not after. Covers PostgreSQL, MySQL/MariaDB, and SQLite, with a dialect-specific checklist and concrete expand/contract rewrite patterns for every unsafe operation it flags.
Buy once — $19, instant download
SKILL.md — the review process Claude Code follows automatically once installed.references/checklist.md — a per-dialect table of which operations lock, which need
rewriting, and which are instant, for Postgres, MySQL/MariaDB, and SQLite.references/safe-patterns.md — six concrete unsafe-to-safe rewrites: NOT NULL columns,
batched backfills, concurrent index creation, foreign keys, renames/drops, type changes.This is the real table from references/checklist.md — not a teaser, the actual
content — so you can check it against a migration right now, no purchase required:
| Operation | Cost | Notes |
|---|---|---|
ADD COLUMN no default, or DEFAULT NULL | Instant | Safe on any table size (PG 11+). |
ALTER COLUMN ... SET NOT NULL | Full table scan, blocking | Add as CHECK (...) NOT VALID, validate, then SET NOT NULL — PG 12+ skips the scan. |
CREATE INDEX | Blocking (write lock for the duration) | Always use CREATE INDEX CONCURRENTLY outside a transaction block. |
ADD CONSTRAINT ... FOREIGN KEY | Blocking scan unless NOT VALID used | NOT VALID then VALIDATE CONSTRAINT in a separate statement. |
ALTER COLUMN ... TYPE | Usually rewrites the table | Exceptions exist (e.g. varchar length increase) — verify per-type. |
The full skill also covers MySQL/MariaDB and SQLite, plus deploy-ordering risk, which is a more common real-world incident cause than lock time alone.
Adding a NOT NULL column to a large or hot table:
-- Unsafe: blocking on many engines/versions ALTER TABLE orders ADD COLUMN status text NOT NULL DEFAULT 'pending'; -- Safe (expand/contract, separate deploys): -- 1. Add nullable, no default enforcement blocking anything ALTER TABLE orders ADD COLUMN status text; -- 2. Backfill in batches (application code, not one giant UPDATE) -- 3. Add the constraint without a blocking scan (Postgres): ALTER TABLE orders ADD CONSTRAINT orders_status_not_null CHECK (status IS NOT NULL) NOT VALID; ALTER TABLE orders VALIDATE CONSTRAINT orders_status_not_null; ALTER TABLE orders ALTER COLUMN status SET NOT NULL; ALTER TABLE orders DROP CONSTRAINT orders_status_not_null; -- 4. (separate deploy) Application code can now rely on status always being set.
db-migration-safety-review/ folder into your project's
.claude/skills/ directory, or ~/.claude/skills/ for use across
all projects.One purchase covers unlimited personal or single-organization use. This is a static pre-deploy checklist, not a substitute for a DBA's review on unusual or very large changes.
The exact same review process, condensed into a single copy-paste prompt for ChatGPT or Claude — no install, no skill directory, works in any chat UI. Paste your migration, get the same dialect-specific lock/rewrite/rollback verdict.