What is an additive migration?
A database change that adds a table, column, index or permission without removing anything existing code still needs.
Because it only adds, an additive migration can be applied before the code that uses it. Old code keeps working. New code finds what it expects.
That ordering matters when code deploys automatically after a merge. If the code arrives before the database is ready, it fails in production.
A migration that has already been applied is never edited. A defect is fixed by adding a new migration. Otherwise two environments can disagree about what the same migration did.
Lessons that use it
- 19The database must be ready firstCode that deploys by itself must never arrive before the tables it expects.
The ruleDatabase first, code second, and never rewrite a migration that has already run.
- 15What happens after the code worksWorking code starts the delivery. It does not finish it.
The ruleTreat "it works here", "it is deployed" and "it works for users" as three different claims.