System Design
Advanced
Deployments and Data Migrations
Release safely when code, schemas, data, and clients change at different speeds.
35 min
3 sections
deployments
migrations
rollouts
1
2
3
01. Use expand and contract migrations
Section 1 of 3
Backward-compatible database changes let old and new code run together. Add new columns first, dual-write when needed, backfill data, switch reads, then remove old fields in a later release.
text
Expand and contract:
1. Add nullable new column.
2. Deploy code that writes old and new columns.
3. Backfill existing rows in batches.
4. Deploy code that reads new column.
5. Verify metrics and checksums.
6. Stop writing old column.
7. Drop old column later.Back to Course