# Migration Safety Gate

> Catches the migration that silently drops your data or locks a production table.

Migration Safety Gate is a paid AI agent skill on Agensi by Zé Francisco Rocha, in Data & Databases. It loads into your AI agent through the Agensi MCP server, always in its latest approved version.

- Price: $5.99 (one-time purchase)
- Creator: [Zé Francisco Rocha](https://www.agensi.io/creators/ze-francisco-rocha)
- Category: [Data & Databases](https://www.agensi.io/skills/data-databases)
- Version: 1.0
- Last updated: 2026-09-05
- Security: scan passed (2026-09-05); every new listing is also reviewed by a person
- Listing: https://www.agensi.io/skills/migration-safety-gate
- Tags: database, postgresql, mysql, devops, sql, code-review

## About this skill

### The failure this catches

Most migrations that cause an outage look completely ordinary in review. The damage comes from four places, and a reviewer reading the file cannot see three of them.

### The four checks

- **Data destruction.** Including the one nobody expects: many ORMs emit `DROP COLUMN` + `ADD COLUMN` when they cannot express an in-place alter. The schema is correct afterwards and every row is null.

- **Locking and downtime.** Which lock each statement takes, on your engine and version - PostgreSQL 11 and 14 differ materially, MySQL differs again. Including the lock-queue trap: a blocked `ALTER TABLE` waiting behind a long read blocks every subsequent query on that table, reads included. A 30-second migration becomes a total outage.

- **Backward compatibility.** Only matters if old and new code run at once during deploy - so it asks, rather than assuming.

- **Reversibility.** And it says plainly whether your rollback restores the *data* or only the *schema*.

### What you get back

A **GO / GO WITH CONDITIONS / NO-GO** verdict on the first line, a severity-ranked findings table, and - the part you actually want - **the rewritten migration as runnable SQL**, split into the separate deploys it really requires. Plus a pre-flight checklist: the exact queries to run for row counts and long-running transactions, and the `lock_timeout` to set.

### Rules it holds to

It never approves a migration whose emitted SQL it has not seen. It never softens a blocker to a warning because the fix is inconvenient. Where the engine version is unknown it reports against the most restrictive plausible version and tells you which it assumed.

## Known limitations

Requires emitted SQL for ORM migrations. Does not analyze query performance or index efficiency. User must provide table row counts and engine versions for accurate locking analysis.

## 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 Safety Gate skill from Agensi" and describe your task.
3. Buy it on the listing or let your agent ask you first; your agent then loads it from Agensi when it needs it. Every paid skill has a money-back guarantee: https://www.agensi.io/docs/money-back-guarantee

## Frequently asked questions

### What specific types of database failures does the Migration Safety Gate prevent?

The skill analyzes migration scripts to detect hidden risks like implicit data loss from ORM 'drop and add' commands, table-locking bottlenecks, and version-specific engine behaviors that could lead to production downtime.

### Which database engines and versions are compatible with this safety gate?

This skill supports PostgreSQL and MySQL, including version-specific nuances (e.g., changes between Postgres 11 and 14) to ensure locking behavior is accurately predicted for your specific environment.

### Does the skill provide a solution if it detects a 'NO-GO' migration?

Beyond just flagging risks, the skill provides a rewritten, runnable SQL script split into safe deployment phases and a pre-flight checklist with specific 'lock_timeout' settings and diagnostic queries.

### Which AI agents or development platforms can I use this skill with?

The Safety Gate can be integrated into most AI-driven code review agents or CI/CD workflows that allow for a SQL analysis step before code is merged or deployed.

### Can this skill identify if a migration will break the current live version of my application during a deploy?

Yes, the skill explicitly checks for backward compatibility and flags migrations that would break existing application code during blue-green or rolling deployments.

---

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.
