Enterprise engineering

How do I deploy database changes with zero downtime?

Use the expand → migrate → contract pattern:

  1. Expand — add backward-compatible nullable columns or indexes that old code ignores
  2. Deploy code that can read both the old and new shape; backfill in measured, restartable batches
  3. Verify metrics, tests and the rollback path before making the new field mandatory
  4. Contract later — remove old columns only after every client and job is migrated and the rollback window has expired

Also: one migration owner who serialises schema changes, replay migrations from a clean database in CI, prefer forward-only migrations with a documented roll-forward plan, and take a backup before risky steps. Never run production DDL or data deletion without authorisation and a rollback plan.

All guides