← Back to Factory Recipes
🗂️

Database Migration Factory

Schema diff, migration generation, rollback planning, and integrity check

Data 7 stages 2 specialists v1.0.0

About

A database migration pipeline that compares current and target schemas, analyzes the impact on foreign keys, indexes, and data volumes, then generates both forward migration and rollback scripts. Scripts are validated via dry-run against a test database before a high-threshold reflection gate reviews safety and completeness. Requires DBA approval with a 4-hour window before production execution.

Input / Output

Input

Target schema or migration specification

text

Output

Validated migration and rollback scripts ready for execution

min quality: 0.9

Pipeline Stages

schema diff

Execute

Compare current and target schemas to identify required changes

👤 analyst 🔧 shell, file_read

impact analysis

Execute

Analyze foreign keys, indexes, and data volume affected by changes

👤 analyst 🔧 shell, file_read ← schema diff

migration gen

Execute

Generate forward migration scripts with proper ordering

👤 engineer 🔧 file_read, file_write ← impact analysis

rollback gen

Execute

Generate rollback scripts to safely reverse every migration step

👤 engineer 🔧 file_read, file_write ← migration gen

dry run

Execute

Validate migration scripts against a test database

👤 engineer 🔧 shell, file_read ← migration gen, rollback gen
🔍

review

Reflect

Review migration safety, data integrity, and rollback completeness

← dry run quality ≥ 0.9 max depth: 2

approval

Approval

DBA approval before executing migration in production

← review timeout: 240m

Tags

databasemigrationschemarollbacksql