Testing & QA Automation
Compatible with Cursor, Claude Code, Cline, Roo Code, Antigravity

Database Migration Rollback & Data Integrity Validation

Validate database schema migrations for zero data loss, backward compatibility, and forward/backward rollbacks.

SQLDatabaseMigrationsLiquibaseFlywayPostgreSQL
Skill Objective

Verify database migration scripts (Flyway, Liquibase, Prisma) for table lock safety, concurrent index creation, and bidirectional rollback integrity.

Execution Workflow Procedure

Ordered steps the coding agent executes when performing this skill.

1

Inspect DDL Table Locking Mechanics

Check whether ALTER TABLE operations trigger ACCESS EXCLUSIVE locks or full table rewrites on high-traffic tables.

2

Verify Expand/Contract Backward Compatibility

Ensure the currently running application build remains compatible while the migration is applied in production.

3

Validate Rollback Data Safety

Run automated Up -> Insert Data -> Down test cycle to prove zero data loss during rollbacks.

Agent Safety Guardrails & Anti-Hallucination Rules

  • DO NOT drop columns or tables in the same release where you stop reading them.
  • DO NOT create indexes without CONCURRENTLY on active tables.

Expected Output Format

Locking risk breakdown, safe SQL scripts, and automated test plan.

⚠️ Locking & Rewrite Risk: Analysis of table lock duration.
🛠️ Hardened Migration SQL: Non-blocking Up and Down SQL scripts.

Domain Verification Checks

Concurrent Indexing: Verifies CREATE INDEX CONCURRENTLY.
Expand/Contract Phasing: Separates schema rollout across multiple application deployments.
Rollback Non-Destructive: Guarantees down scripts do not destroy newly written user data.

Example Agent Invocations

"Validate this Flyway migration script splitting user full_name into first and last name on an 8M row table."
"Check this Prisma migration for zero-downtime deployment safety."

Install / Configure This Skill

# Place in .cursorrules or create .cursor/rules/database-migration-rollback-validation.mdc
# Trigger: Whenever you perform database migration rollback & data integrity validation

---
name: database-migration-rollback-validation
description: Verify database schema migrations for zero-downtime safety, lock prevention, and data loss-free rollbacks.
version: 1.0.0
compatibility: [Cursor, Claude Code, Cline, Roo Code, Antigravity]
---

# Database Migration Rollback & Data Integrity Validation

## Objective
Guarantee zero-downtime database migrations by preventing table locks and verifying bidirectional rollback safety.

## Workflow
1. **Locking Audit**: Verify that DDL operations avoid `ACCESS EXCLUSIVE` locks on large tables.
2. **Expand/Contract Compatibility**: Ensure active application pods run safely during migration execution.
3. **Rollback Verification**: Test Up -> Data Insertion -> Down sequence to verify data preservation.
Complementary Agent Prompt

Need a quick one-time prompt for chat?

Try the Database Migration Rollback & Data Integrity Test Plan — a lightweight version designed for 1-click copying directly into Claude, ChatGPT, or Cursor chat.

View Prompt

SprintKit Workflow Integrations

Complementary tools and checklists to pair with this agent workflow.

Related Agent Skills

Explore related procedural workflows in this discipline.

All Skills

Relational Database Schema Normalization & Indexing Strategy

Design production PostgreSQL schemas with composite indexes, foreign key strategies, and partitioning.

PostgreSQLSQLDatabase+2
3 workflow stepsView skill

Database Deadlock & Concurrency Race Condition Diagnosis

Diagnose Postgres/MySQL transaction deadlocks, lock contention, and concurrent update race conditions.

SQLPostgreSQLMySQL+3
3 workflow stepsView skill

Database Zero-Downtime Migration & Rollback Orchestration

Plan high-volume, live table restructuring and large column migrations without application outages.

DatabasePostgreSQLDevOps+2
4 workflow stepsView skill