Database Migration Safety Review

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

What's inside

Which migrations actually block writes? (free excerpt, PostgreSQL)

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:

OperationCostNotes
ADD COLUMN no default, or DEFAULT NULLInstantSafe on any table size (PG 11+).
ALTER COLUMN ... SET NOT NULLFull table scan, blockingAdd as CHECK (...) NOT VALID, validate, then SET NOT NULL — PG 12+ skips the scan.
CREATE INDEXBlocking (write lock for the duration)Always use CREATE INDEX CONCURRENTLY outside a transaction block.
ADD CONSTRAINT ... FOREIGN KEYBlocking scan unless NOT VALID usedNOT VALID then VALIDATE CONSTRAINT in a separate statement.
ALTER COLUMN ... TYPEUsually rewrites the tableExceptions 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.

One rewrite pattern in full, so you can judge the quality before buying

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.

Install

  1. Buy and unzip the download.
  2. Copy the db-migration-safety-review/ folder into your project's .claude/skills/ directory, or ~/.claude/skills/ for use across all projects.
  3. That's it — no configuration, no API keys. Claude Code loads it automatically and applies it whenever a migration is being written or reviewed.

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.

Don't use Claude Code? Get the same review as one prompt

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.

Buy the prompt — $4.99, instant download