Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIMuseMuseDotsDots+21 more

    DB Migration Safety Checker

    1

    This skill audits your migration before it touches production: lock acquisition analysis, estimated execution time at your actual data volume, index build strategy (concurrent vs.

    $9.99

    Secure checkout via Stripe

    Money-back guarantee

    Converts to your local currency at checkout

    Security scanned
    DB Migration Safety Checker

    DB Migration Safety Checker

    Example session with this skill installed

    Postgres 14 with Rails, rolling deploys. The orders table has about 80M rows (120 GB). I want to rename the status column to order_status and add a NOT NULL region column filled from shipping_country. Is this safe?

    • Read your context and instructions
    • Compiled the db migration safety

    Not safe as a single migration. Both changes need an expand-contract sequence on an 80M row table.

    Lock and rewrite analysis

    ChangeLockRewriteRisk
    RENAME COLUMNACCESS EXCLUSIVE, briefNoOld app pods fail mid rolling deploy
    ADD COLUMN region nullableACCESS EXCLUSIVE, briefNoLow
    Backfill in one UPDATERow locks on all rowsHeavy WAL, bloatHigh
    SET NOT NULL directlyACCESS EXCLUSIVE + full scanNoHigh

    Safe sequence

    1. Add order_status and region as nullable columns. Set lock_timeout = '5s'.
    2. Deploy code that writes both status and order_status.
    3. Backfill both columns in batches:
    UPDATE orders SET order_status = status,
      region = map_region(shipping_country)
    WHERE id BETWEEN :start AND :end
      AND order_status IS NULL;
    

    Batches of 10k to 50k rows, a short pause between them.
    4. ADD CONSTRAINT region_nn CHECK (region IS NOT NULL) NOT VALID, then VALIDATE CONSTRAINT, then SET NOT NULL (skips the scan on PG 12+).
    5. Switch reads to order_status, deploy.
    6. Stop writing status, then drop it in a later release.

    Rollback plan

    Steps 1 to 5 are reversible: old code still reads status. Only step 6 is one way, so take it after a full release cycle.

    Next steps

    • Define map_region and test it on a sample
    • Run the backfill on a staging copy first

    Connects securely to your tools. The creator never sees your data.

    About this skill

    The migration ran instantly in staging and locked a 40-million-row table in production for nine minutes — because staging had 400 rows. This skill audits your migration before it touches production: lock acquisition analysis, estimated execution time at your actual data volume, index build strategy (concurrent vs. blocking), column default pitfalls, constraint validation timing, and the exact zero-downtime sequence if your migration needs one. It also writes the rollback script, because migrations that can't be undone shouldn't be run without one. Use it on every migration that touches a table with more than 10,000 rows, adds a NOT NULL column, drops anything, or runs during business hours. Give it your migration file and your production table sizes; it returns the risk assessment and the safe execution plan.

    • Cannot verify actual production load or existing lock contention in real-time.
    • Accuracy depends on providing the correct DB engine and version.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before any payment.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Money-back guarantee

    Doesn't do what its page promises? You get your money back.

    Trust & safety

    Security scan

    Security scan passed 4 months ago

    Permissions

    No special permissions declared or detected

    Listed4 months ago
    Updated12 days ago

    What's inside

    Frequently Asked Questions

    It identifies statements that trigger table rewrites or exclusive locks (like adding columns with defaults in older versions) and provides concurrent alternatives.

    While it covers most SQL engines, performance is highest for PostgreSQL and MySQL where version-specific locking behavior is well-documented.

    The skill creates the 'expand-contract' pattern (add new, sync data, then drop old) and generates the required rollback SQL for each step.