1

    Migration Guard

    by J. Shtal

    Catches the database migrations that lock tables or lose data — before they hit production.

    Updated Jul 2026
    Security scanned
    Flyway

    $10

    · or 50 credits

    30-day refund guarantee

    Secure checkout via Stripe

    Included in download

    • Prevent production table locks from blocking DDL statements
    • Convert dangerous schema changes into zero-downtime deployment steps
    • terminal, file_read automation included
    • Ready for Flyway
    • Instant install

    See it in action

    You say

    Review this migration for a high-traffic Postgres DB: ALTER TABLE orders ADD COLUMN status text DEFAULT 'pending' NOT NULL;

    Your agent does

    === CRITICAL === [MG-030] migration.sql:1 Adding NOT NULL while the old app version still writes without it is a rolling-deploy hazard. fix: Expand-contract: add nullable with a default, deploy the writer, backfill, then SET NOT NULL.

    Summary: 0 blocker, 1 critical, 0 warning.

    About This Skill

    The problem

    Database migrations that work fine in development often lock tables, lose data, or break production during a rolling deploy. Standard CI catches syntax errors — it rarely catches a CREATE INDEX that freezes writes for ten minutes, or a RENAME that breaks the app version still running the old code.

    What it does

    • Reviews SQL, Flyway, and Liquibase migrations for Postgres, MySQL, and Oracle against ~48 dialect-specific safety rules.
    • Flags blocking DDL (non-concurrent indexes, table rewrites, unvalidated constraints), data loss (DROP, TRUNCATE, UPDATE without WHERE), and zero-downtime hazards (RENAME, backfills, missing lock_timeout).
    • Rewrites unsafe migrations into a safe, ordered sequence — expand-contract, batched backfills, two-step constraint validation — instead of just flagging the problem.
    • Outputs text for local review, or JSON/SARIF for CI gates and GitHub code scanning.

    Why it's worth having

    These are well-known traps, but they're easy to miss in a normal code review — nobody reads a migration file thinking about ACCESS EXCLUSIVE locks on a 100M-row table. migration-guard encodes that expertise so your agent (and your CI) catches it every time, not just when someone remembers to check.

    Example

    ALTER TABLE orders ADD COLUMN status text NOT NULL; looks harmless. migration-guard flags it as a BLOCKER (forces a full-table rewrite under an exclusive lock) and rewrites it into three safe migrations: add the column nullable, backfill in batches, then enforce NOT NULL via a validated check.

    Free vs full

    A free edition covering BLOCKER-level lock and data-loss rules is available on GitHub. This full edition adds every CRITICAL/WARNING rule, the zero-downtime rewrite engine, MySQL support, and JSON/SARIF output for CI.

    Use Cases

    • Prevent production table locks from blocking DDL statements
    • Convert dangerous schema changes into zero-downtime deployment steps
    • Verify SQL migrations against JPA entities to prevent runtime errors
    • Create batched backfill scripts for adding NOT NULL constraints

    How to install

    Drop the file into your AI tool. Works with Claude, Cursor, ChatGPT, and 20+ more.

    Reviews

    No reviews yet - be the first to share your experience.

    Only users who have downloaded or purchased this skill can leave a review.

    Security Scanned

    Passed automated security review

    Permissions

    Terminal / Shell
    Read Files

    File Scopes

    **/*.sql
    **/*.xml
    **/*.yml
    **/*.yaml

    Reads .sql/.xml/.yaml files under the target path given as a CLI argument (migration files the user points it at). No network access, no writes — output goes to stdout only.

    Requires Python 3.9+ and the sqlglot package (pip install sqlglot). No database connection needed — pure static analysis of SQL/Flyway/Liquibase files. Tested with Claude Code; works with any SKILL.md-compatible agent.

    Creator

    Frequently Asked Questions

    More Premium Skills