- Home
- Skills
- Data & Databases
- DB Migration Safety Auditor
DB Migration Safety Auditor
Audit SQL, Rails, Django, and Prisma migrations for blocking locks, data loss, and deployment breaking changes.
$15
Works with the AI tools you already use
DB Migration Safety Auditor
Example session with this skill installed
Review this Rails migration adding a foreign key: add_reference :orders, :users, foreign_key: true, index: false. The orders table has 50 million rows.
- Read your context and instructions
- Compiled the db migration safety
I have reviewed the migration for orders. While the syntax is correct, this will cause a significant blocking lock on a 50M-row table.
Migration Review — orders
| Risk Level | Type | Finding | Impact |
|---|---|---|---|
| Blocking | Table Lock | add_reference :orders, :users | Adding a foreign key constraint requires a full table scan to validate existing data, locking the orders table for the duration. |
| Blocking | Index Lock | add_index :orders, :user_id | If you later add the index manually, a standard add_index will lock writes to orders. |
| Data-risk | Constraint | foreign_key: true | Validation will fail if there are orphaned user IDs in the orders table. |
Safer approach:
To avoid a production outage, split this into three steps:
- Add the column without the constraint:
add_column :orders, :user_id, :bigint. - Add the index concurrently (PostgreSQL):
add_index :orders, :user_id, algorithm: :concurrently. - Add the foreign key without validation, then validate it separately:
add_foreign_key :orders, :users, column: :user_id, validate: false
# In a separate migration
validate_foreign_key :orders, :users
Next steps
- Verify if any
ordersrows containuser_idvalues that do not exist in theuserstable. - Confirm you are running PostgreSQL to use the
concurrentlyalgorithm. - Schedule the
validate_foreign_keystep for a lower-traffic window.
Connects securely to your tools. The creator never sees your data.
What you get
About this skill
The problem
Migrations that run instantly on a local machine can take production tables offline for minutes. Standard AI agents focus on schema correctness but ignore how databases execute changes under load or during rolling deploys.
What it does
- Scans migration files for blocking locks, non-concurrent indexes, and unsafe type changes.
- Identifies backward-incompatible changes that break blue-green deployments.
- Detects irreversible operations like empty downgrades or lossy retypes.
- Provides concrete "expand and contract" rewrite strategies for high-risk operations.
Frameworks & tools
Supports raw SQL, Ruby on Rails (ActiveRecord), Python (Django, Alembic), and TypeScript (Prisma). Works with PostgreSQL and MySQL engines.
Why this beats prompting it yourself
Generic prompts often miss the multi-step nature of safe migrations. This skill applies a specific risk rubric to distinguish between safe changes on small tables and outage-causing locks on high-traffic ones, providing the actual code for the fix.
Use cases
- Reviewing PRs that modify schema files or add new migration scripts.
- Auditing a migration plan for a table with millions of rows.
- Ensuring zero-downtime compatibility for rolling application updates.
- Validating that all database changes have a functional rollback path.
Known limitations
Does not audit schema design or naming conventions. Requires manual input or inference regarding table row counts to determine final lock severity.
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 20 days ago
- Passed all security checks, Safe to install