- Home
- Skills
- Data & Databases
- Database Migration Test Harness
Works with the AI Agents you already use
Database Migration Test Harness
Execute database migrations in a disposable environment, seed realistic edge cases, validate data/schema invariants, measure timings, test rollback, and produce a migration safety report before production.
$5
Database Migration Test Harness
Example session with this skill installed
Test this database migration before it reaches production.
Database engine
PostgreSQL
Baseline
./schema.sql
Migration up
./migrations/20261008_add_order_status.sql
Migration down
./migrations/20261008_add_order_status.down.sql
Repository
./
Requirements
- use a disposable database or Docker container;
- never connect to production;
- load existing seed/fixture data when available;
- generate additional edge-case fixtures from existing constraints;
- capture schema and row-count state before migration;
- execute the real up migration;
- measure migration timing;
- detect destructive or high-risk operations;
- validate structural and data invariants;
- check foreign-key integrity;
- test the down migration;
- compare rollback state against the baseline;
- report failed invariants and rollback status;
- distinguish test-environment timing from production timing;
- generate migration_safety_report.md, migration_summary.json, invariant_results.csv, timings.json, and schema snapshots.
- Read your context and instructions
- Compiled the database migration test
- Generated the data export
Database migration safety test complete
Engine
PostgreSQL 17
Environment
Disposable Docker database
Migration
20261008_add_order_status.sql
Seed rows
48,216
Migration up
Status
PASS
Duration
2.84s
Timing class
TEST_ENVIRONMENT_TIMING
Structural validation
Tables preserved
18 / 18
Baseline columns preserved
143 / 143
New columns
orders.status
orders.status_updated_at
Foreign-key violations
0
Data invariants
PASS — Order row count preserved
48,216 → 48,216
PASS — Primary-key uniqueness preserved
PASS — No orphan order/customer relationships introduced
PASS — Existing orders received valid status values
PASS — NOT NULL invariant satisfied after backfill
Edge-case fixtures
Tested
- order with nullable optional metadata
- oldest supported timestamp
- duplicate external reference candidate
- customer with maximum order count fixture
- zero-item canceled order
Result
5 / 5 PASS
Risk finding
REVIEW — NOT NULL introduction
The migration adds
orders.status TEXT NOT NULL
The migration also backfills existing rows before applying the final constraint.
Production consideration
Validate backfill and locking behavior with production-scale row counts before deployment.
Rollback
Status
PASS
Duration
1.11s
Baseline tables restored
18 / 18
Baseline columns restored
143 / 143
Baseline row counts preserved
PASS
Final verdict
REVIEW
Files generated
- migration_safety_report.md
- migration_summary.json
- invariant_results.csv
- timings.json
- schema_before.sql
- schema_after.sql
- rollback_schema.sql
- fixture_summary.json
This harness validates the migration in an isolated test environment. Production safety still depends on real data volume, engine/version behavior, deployment strategy, and backup/restore readiness.
invariant_results.csv
CSV · data export
Example file from a real run - the skill writes it into your workspace.
Connects securely to your tools. The creator never sees your data.
About this skill
The problem
A migration can be syntactically valid and still be operationally dangerous.
It may block a hot table, violate hidden data assumptions, lose rows during a transformation, or fail completely when rolled back.
What it does
- Builds a disposable database from the baseline schema
- Loads existing or generated edge-case fixtures
- Captures pre-migration schema and data state
- Executes the real migration
- Validates structural and data invariants
- Measures migration timing
- Flags destructive SQL patterns
- Runs the down migration when available
- Compares rollback state against the baseline
- Generates a migration safety report
Why this beats prompting it yourself
A generic prompt can review migration SQL.
This skill actually runs the migration and compares database states:
Baseline → Seed → Migrate Up → Validate → Measure → Rollback → Compare → Safety Report
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Data & Databases.
Harness timing is environment-specific and may not reflect production lock durations. Requires a local Docker environment or ephemeral database access to execute.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 1 month ago