- Home
- Skills
- Data & Databases
- Migration Safety Gate
Migration Safety Gate
Catches the migration that silently drops your data or locks a production table.
$5.99
Works with the AI tools you already use
Migration Safety Gate
Example session with this skill installed
Review this PostgreSQL 14 migration for a table with 50M rows: ALTER TABLE orders ADD COLUMN status VARCHAR(255) DEFAULT 'pending' NOT NULL; ALTER TABLE orders ADD COLUMN metadata JSON;
- Read your context and instructions
- Compiled the migration safety gate
- Generated the document
The migration was analyzed for PostgreSQL 14. Adding a column with a constant default is metadata-only in this version, but the second operation carries minor risks.
Verdict — GO WITH CONDITIONS
Findings
| # | Statement | Class | Severity | Impact | Fix |
|---|---|---|---|---|---|
| 1 | ADD COLUMN status | Locking | Note | Minimal on PG 11+ due to fast default. | Ensure no long-running transactions exist. |
| 2 | ADD COLUMN metadata | Locking | Warning | ACCESS EXCLUSIVE lock could block the queue. | Use a lock_timeout for the session. |
| 3 | Combined ops | Deploy | Warning | Total lock time increases with multiple DDLs. | Split into individual transactions. |
Rewritten Migration
-- Step 1: Set a short lock timeout to prevent queue pile-up
SET lock_timeout = '2s';
-- Step 2: Add columns (Fast in PG 14)
ALTER TABLE orders
ADD COLUMN status VARCHAR(255) DEFAULT 'pending' NOT NULL,
ADD COLUMN metadata JSON;
Pre-flight Checklist
- Verify Table Size:
SELECT pg_size_pretty(pg_total_relation_size('orders'));
Check Active Locks: Run SELECT pid, state, query FROM pg_stat_activity WHERE wait_event_type = 'Lock'; before running.
*
Transaction Check: Ensure no long-running analytical queries are holding ACCESS SHARE locks on the orders table.
Next steps
- Run the row count and lock check queries provided in the checklist.
- Apply the migration during a period of lower traffic to minimize the impact of the brief
ACCESS EXCLUSIVElock.
migration-safety-gate.pdf
PDF · document
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
What you get
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 COLUMNwhen 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 TABLEwaiting 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.
How to install
Works the same in every agent - Claude, Cursor, Codex, Copilot and 20+ more.
- 1
Download the ZIP
Free skills download straight away. Paid skills unlock right after purchase.
- 2
Unzip into your skills folder
Every agent reads skills from one folder on your machine. Drop the unzipped folder in there.
- 3
Ask your agent to use it
Restart the agent if it was already running. It picks the skill up automatically - no config needed.
Skills folder by agent
Click the path to copy it. Create the folder if it does not exist yet.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
30-day refund
Not a fit? Get your money back
Trust & safety
Security scanned
Verified clean 27 days ago
- Passed all security checks, Safe to install