Back to Skills

zero-downtime-migration

verified

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 GitHub

Marketplace

orchestkit

yonatangross/orchestkit

Plugin

ork

development

Repository

yonatangross/orchestkit
33stars

skills/zero-downtime-migration/SKILL.md

Last Verified

January 25, 2026

Install Skill

Select agents to install to:

Scope:
npx add-skill https://github.com/yonatangross/orchestkit/blob/main/skills/zero-downtime-migration/SKILL.md -a claude-code --skill zero-downtime-migration

Installation paths:

Claude
.claude/skills/zero-downtime-migration/
Powered by add-skill CLI

Instructions

# 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)         │
│                                                                          │
└────────────────────────────────

Validation Details

Front Matter
Required Fields
Valid Name Format
Valid Description
Has Sections
Allowed Tools
Instruction Length:
8079 chars