Lesson 2 · Unit 04
Risky changes
Expand and contract, flags, and what cannot be undone
What you practise
- Data migrations, a flag to switch behaviour, staying compatible with old callers, a way back
- The diff that needs a second reviewer
Try a question from this lesson
Pick one
A deploy first renames a database column, then replaces the servers one at a time with code that uses the new name. What happens in between?
Correct answer
Servers still on the old code fail: their column is gone
Why
For a few minutes old code runs against the new schema and asks for a column that no longer exists. Renaming after the servers are replaced breaks the new code the same way. Old and new always overlap during a deploy.
The idea
Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.
Concept
Expand, migrate, contract
Old and new code overlap during every deploy, so a breaking change is split into steps that are each safe on their own.
Expand: add the new thing beside the old. Migrate: move the writers, the data and the readers. Contract: remove the old thing, once nothing uses it.
Every step can be rolled back except the last, so the last one waits.
10 more exercises in the app
- 1× order the lines
- 5× multiple choice
- 1× type the answer
- 1× true or false
- 1× fill the blanks
- 1× match the pairs
Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.