cyberneticlibrary

Plan zero-downtime database migrations

database-migrationsskillsetup L20
Sheshiyer/skill-clusters
What it does

Design safe, reversible schema changes for production databases

Best for

When you must alter production schema without downtime and need to prove rollback works.

Inputs
  • · migration scripts (DDL/DML)
  • · test data (production-size)
  • · rollback plan
Outputs
  • · applied migration
  • · documented rollback procedure
  • · tested against production copy
Requires
  • · PostgreSQL / MySQL
  • · Prisma / Drizzle / Kysely / Django / TypeORM / golang-migrate
Preconditions
  • · migration reversible or explicitly marked irreversible
  • · no full table locks on large tables
  • · new columns nullable or have defaults
Failure modes
  • · applied migration without down() defined
  • · NOT NULL without default on large table (full rewrite)
  • · concurrent index created inside transaction
Trust signals
  • · migrate tested against production-sized data
  • · expand-contract pattern used for column renames
  • · batched updates with SKIP LOCKED