Zero-Downtime Database Migrations

TL;DR AI
2 min readKey summary
Zero-downtime migrations work best when schema changes and code changes are separated and rolled out in phases.
Column adds, renames, drops, and type changes should use compatible intermediate steps instead of one-shot updates.
Large backfills should run in batches, and indexes should be created concurrently to reduce locks and performance hits.
Planning rollback steps before deployment helps avoid outages and limits risk in live production systems.
