Safe database schema changes without downtime using expand-contract pattern and online schema changes. Use when deploying schema changes to production without service interruption.
View on GitHubyonatangross/orchestkit
orchestkit-complete
January 24, 2026
Select agents to install to:
npx add-skill https://github.com/yonatangross/orchestkit/blob/main/./skills/zero-downtime-migration/SKILL.md -a claude-code --skill zero-downtime-migrationInstallation paths:
.claude/skills/zero-downtime-migration/# Zero-Downtime Migration (2026) Database migration patterns that ensure continuous service availability during schema changes. ## Overview - Deploying schema changes to production systems with uptime requirements - Renaming or removing columns without breaking existing application code - Adding NOT NULL constraints to existing columns with data - Creating indexes on large tables without locking - Migrating data between columns or tables during live traffic - Using pgroll for automated expand-contract migrations ## Quick Reference ### Expand-Contract Overview ``` ┌─────────────────────────────────────────────────────────────────────────┐ │ EXPAND-CONTRACT PATTERN │ ├─────────────────────────────────────────────────────────────────────────┤ │ │ │ Phase 1: EXPAND Phase 2: MIGRATE Phase 3: CONTRACT│ │ ───────────────── ────────────────── ──────────────── │ │ Add new column Backfill data Remove old column │ │ (nullable) Update app to use new (after app migrated)│ │ Both versions work │ │ │ │ ┌─────────┐ ┌─────────┐ ┌─────────┐ │ │ │old_col │ ───────────────>│old_col │ ─────────────> │new_col │ │ │ │ │ │new_col │ │ │ │ │ └─────────┘ └─────────┘ └─────────┘ │ │ │ │ Rollback: Drop new Rollback: Use old Rollback: N/A │ │ (dual-write in app) (commit) │ │ │ └────────────────────────────────