# Migration Guard: catch downtime-causing database migrations

> Reviews your database migrations before they ship. Catches table-locking index builds, NOT NULL columns without defaults, table rewrites, and column drops or renames that your code still uses, then rewrites them as safe zero-downtime steps with a deploy plan.

Migration Guard: catch downtime-causing database migrations is a free AI agent skill on Agensi by Liji Mariyam mathew, in Data & Databases. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: Free
- Creator: [Liji Mariyam mathew](https://www.agensi.io/creators/liji-mariyam-mathew)
- Category: [Data & Databases](https://www.agensi.io/skills/data-databases)
- Version: 1.0
- Last updated: 2026-11-27
- Security: scan passed (2026-11-27); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/migration-guard-catch-downtime-causing-database-migrations
- Tags: devops, postgresql, django, rails, alembic, mysql, migrations, zero-downtime

## About this skill

Some migrations look harmless and still take production down. Migration Guard checks new or changed migrations on your branch and gives a ✅ SAFE / ⚠️ REVIEW / ⛔ BLOCK verdict.

What it catches:
- indexes built without CONCURRENTLY, including the ones Django and Rails create for you
- NOT NULL columns with no database default (including Alembic's Python-only default=)
- type changes and volatile defaults that rewrite the whole table
- dropped or renamed columns, with the files in your code that still use them
- foreign keys and constraints validated under lock
- unbatched backfills and missing rollbacks

What you get: a rewrite in your own framework (Alembic, Django, Rails, Knex, raw SQL; Prisma and Flyway via SQL) and a step-by-step deploy plan. PostgreSQL is fully supported; MySQL gets the core rules.

Read-only and safe: it never connects to your database, never runs migrations, and makes no network calls. Tested on 1,760 real migrations from large open-source projects.

## Requires

- Git
- Python 3.9+

Run your agent from the project root. Read-only by default: it never connects to your database or runs migrations, and only edits files if you ask it to apply the safe version.

## Known limitations

Read-only. Cannot connect to live DBs. Table sizes must be provided or inferred from docs. SQL generation requires a working local environment for the specific ORM.

## 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 Migration Guard: catch downtime-causing database migrations 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 connect to my database or run migrations?

No. It only reads your migration files and code. It never connects to a database, runs migrations or makes network calls.

### Which frameworks and databases are supported?

Raw SQL, Alembic, Django, Rails and Knex; Prisma and Flyway through their SQL files. PostgreSQL is fully supported and MySQL gets the core rules.

### How does it know my table is large?

It assumes tables are large unless you say otherwise or your README/notes mention sizes. Tell your agent "the settings table is small" and those lock warnings become notes.

### Will it change my files?

Only if you ask it to apply the safe version. By default it reviews and shows the rewrite.

### Can I use it in CI?

Yes. The bundled checker supports `--fail-on block` and exits with code 2 when a migration would cause downtime.

---

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.
