# DB Migration Safety Reviewer: Zero-Downtime Schema Changes

> Paste a migration before you merge it: get a SAFE / UNSAFE verdict per statement with the exact lock it takes, then a rewritten expand/contract version with online DDL, batched backfills, deploy order and rollback. PostgreSQL, MySQL, SQL Server, any ORM.

DB Migration Safety Reviewer: Zero-Downtime Schema Changes is a free AI agent skill on Agensi by a365ngay, in Data & Databases. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [a365ngay](https://www.agensi.io/creators/a365ngay)
- Category: [Data & Databases](https://www.agensi.io/skills/data-databases)
- Version: 1.0
- Last updated: 2026-11-28
- Security: scan passed (2026-11-28); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/db-migration-safety-reviewer-zero-downtime-schema-changes
- Tags: database, devops, code-review, postgresql, mysql, sql-server, database-migrations, zero-downtime

## About this skill

**The migration that took 3 seconds in staging can lock your biggest table for an hour in production.** This skill reviews schema changes the way a careful DBA does, before they ship.

### For every statement it tells you
- The **lock it takes** and what that blocks (reads, writes or both), for your engine and version.
- Whether it **rewrites or scans** the table, and roughly how long that takes at your size.
- Whether it breaks the **app version still running** during a rolling deploy (renames, drops, NOT NULL, type changes).
- The **lock queue trap**: a 5 ms ALTER waiting behind a long transaction that freezes every query on the table.

### Then it rewrites it safely
- Expand, backfill, contract: split into migrations and app releases in the right order.
- Online forms: `CREATE INDEX CONCURRENTLY`, `NOT VALID` + `VALIDATE`, `ALGORITHM=INSTANT/INPLACE`, `ONLINE = ON`, gh-ost / pt-online-schema-change (with their limits, such as gh-ost and foreign keys).
- Batched, idempotent, resumable backfills that watch replica lag.
- Lock timeouts with retry, and the right no-transaction or algorithm option for Rails, Django, Alembic, EF Core, Flyway, Liquibase, Laravel, Knex.
- A **runbook**: order, duration estimate, what to monitor, when to stop, rollback per step.

### Migration stuck right now?
Rescue mode gives the read-only query that shows who is blocking whom and the safest thing to cancel, and leaves the decision to you.

PostgreSQL, MySQL/MariaDB (including RDS) and SQL Server (with edition differences). Works in any language and answers in yours.

**Pairs with:** *SQL Query Clinic* (free) for the index, *Incident Postmortem* (free) if it already went wrong.

## Requires

Nothing beyond your AI agent.

## Known limitations

Reviews what you paste; it does not connect to your database or run anything. Lock behavior is version- and edition-specific, so it asks for exact versions and states assumptions when they are missing. Duration figures are estimates from table size, not measurements. Business decisions (how to resolve duplicates, whether a type change is needed) are left to you.

## How to use this skill

1. Connect your AI agent to Agensi once: add the MCP server https://mcp.agensi.io/mcp/auth and sign in with your Agensi account (OAuth, no API key). Steps for Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and other agents: https://www.agensi.io/docs/mcp-setup
2. Ask your agent: "Use the DB Migration Safety Reviewer: Zero-Downtime Schema Changes skill from Agensi" and describe your task.
3. Your agent loads the skill from Agensi when it needs it. Nothing is downloaded.

## Frequently asked questions

### Does it run the migration or connect to my database?

No. It reviews the migration and context you paste and gives you rewritten migrations, scripts and commands to run yourself. In rescue mode it gives read-only queries to find the blocker and leaves any cancel or kill decision to you.

### Which databases and versions does it cover?

PostgreSQL, MySQL/MariaDB (including RDS and Aurora notes) and SQL Server (including Standard vs Enterprise differences for online operations). It asks for the exact version because lock behavior changes between versions, for example PostgreSQL 11+ fast defaults or MySQL 8.0.29 INSTANT changes.

### Does it work with my ORM's migrations?

Yes: Rails, Django, Alembic, Prisma, EF Core, Laravel, Flyway, Liquibase, Knex and raw SQL. It reviews the SQL the tool generates and answers in your tool's style, including the right no-transaction or ALGORITHM option for that tool and database.

### What do SAFE, SAFE WITH CHANGES and UNSAFE mean?

SAFE: every statement takes only brief locks and works with the app version still running. SAFE WITH CHANGES: small fixes needed, such as a lock timeout or an online option. UNSAFE: something would block traffic for long, rewrite a big table, break running code or risk data; you get a step-by-step safe version.

### My migration is hanging production right now. Can it help?

Yes. Rescue mode gives the query that shows who is blocking whom for your engine, explains why cancelling the waiting migration is usually safer than killing app sessions, and what each option rolls back. You run the commands; afterwards it reviews the migration properly.

### How accurate are the duration estimates?

They are rough estimates from the table size and write rate you give, labeled as such. For big rebuilds it recommends measuring on a production-size copy before the real run.

---

Source: [Agensi](https://www.agensi.io), the marketplace of skills for AI agents. Any MCP-compatible agent (Claude, ChatGPT, Claude Code, Codex, Cursor, VS Code and more) connects at https://mcp.agensi.io/mcp/auth and signs in with an Agensi account; setup for every agent: https://www.agensi.io/docs/mcp-setup. Append .md to any skill, guide or docs address on agensi.io for its markdown version.
