schema-migration

Create timestamped, idempotent SQL and Alembic migrations for zero-downtime schema changes.

Updated Mar 20, 2026
One-click install
npx skills add https://github.com/hendrax5/ironman --skill schema-migration-hendrax5
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: schema-migration
Source: https://github.com/hendrax5/ironman/tree/main/skills/migration
Command: npx skills add https://github.com/hendrax5/ironman --skill schema-migration-hendrax5

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill codifies safe, repeatable database migration practices to enable schema and data changes without production downtime, accidental destructive operations, or irreversible edits to merged migration files.

Core Features & Use Cases

  • Naming & Idempotency: Enforces timestamped migration filenames and idempotent UP/DOWN SQL so migrations can be applied safely multiple times.
  • Zero-Downtime Expand-Contract: Prescribes the Expand → Migrate → Transition → Contract pattern for renames and destructive changes to avoid locks and downtime.
  • Separation of Concerns & Rollbacks: Requires DDL and DML to be separated into different files, mandates explicit rollback/downgrade implementations, and forbids direct destructive operations on main branches.
  • Use Case: Add a nullable column, backfill values in a separate data migration, switch application writes to the new column, then remove the old column during the contract phase.

Quick Start

Use the schema-migration skill to create a timestamped DDL migration that adds a nullable column, write a separate DML backfill, and follow the expand-migrate-transition-contract workflow.

Frequently Asked Questions about schema-migration

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I perform zero-downtime database migrations on a production relational database?

Zero-downtime database migrations use the expand-contract pattern to apply phased schema changes without locking tables. You add nullable columns, backfill data separately, switch application writes, and remove old columns during the contract phase.

How do I write idempotent SQL and Alembic migration files for schema changes?

Idempotent SQL and Alembic migrations require timestamped filenames and UP/DOWN scripts that execute safely multiple times. You must separate DDL schema changes from DML data operations and include explicit rollback paths for every migration.

What is the expand-contract pattern for renaming database columns without downtime?

The expand-contract pattern for database migrations avoids downtime by executing four phases: expand to add the new column, migrate to backfill values, transition application writes to the new schema, and contract to remove the old column.

Can I use this approach to add an index or backfill data on a large production database?

Yes, this approach supports index creation and data backfills on relational production databases by separating DDL and DML into distinct migration files. You run backfills as separate data migrations to avoid locking issues during large schema updates.

Why should DDL and DML be separated into different database migration files?

Separating DDL and DML into different migration files prevents locking conflicts and ensures safe rollback paths. DDL schema changes and DML data backfills execute independently, making the zero-downtime expand and migrate phases reliable and reversible.

What are the limitations of modifying merged database migration files?

Merged database migration files are immutable; modifying them breaks idempotency and rollback consistency. You must never edit merged migrations directly on main branches or perform destructive operations without following the expand-contract workflow.