Backend Developer
hardzero-downtime-migrations
How do you run zero-downtime database migrations?
Answer
Zero-downtime migrations avoid breaking production traffic.
**Common approach:**
- Expand/contract pattern
- Add nullable columns first
- Backfill data in batches
- Deploy code that writes both old/new (dual-write) if needed
- Switch reads to new column
- Remove old column later
Always test on staging and monitor during rollout.
Related Topics
DatabasesDeploymentReliability