Expand and contract
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
restructure a column without downtime.
Planned topics
- Expand: add the new column (nullable); deploy code that writes to both and reads the old.
- Migrate: backfill old rows in batches; verify.
- Switch: deploy code that reads the new column; keep writing both for a while.
- Contract: stop writing the old column, then drop it in a later release.
- Each step is backward compatible with the previous app version, so any step can be rolled back.
Draft outline details
Demonstration
a five-release table for renaming customer.name to full_name: add column, dual-write, backfill, switch reads, drop old.
Check your understanding
Why is ALTER TABLE customer RENAME COLUMN in one step unsafe while old app instances run?
Show answer
Old instances still use the old name and fail immediately.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.