The Book of DevOps Patterns : #4 - Database migration
The Book of DevOps Patterns is a long series of patterns used by DevOps. Each story is introduced in a synthetic way by going to the essential. For more patterns, read my book DevOps Patterns DevOps (https://www.amazon.com/DevOps-Patterns-Guide-Bruno-Delb-ebook/dp/B08QSMX9LC).
When deploying a new release in a CD, the database migration is a sensitive operation. There are two main patterns, although there are a few other options :
- Blue/Green environment,
- decoupling of changes.
The workflow of the first pattern, Blue/Green environment, is:
- the Blue database is set to read-only mode;
- it is then saved;
- this backup is restored on the Green database;
- the traffic is then directed to the Green environment.
The limitation is that if a rollback is needed, transactions may be lost.
The second pattern, decoupling of changes, is much more simple: changes in the database and changes in the application are decoupled.
The limitations are that changes are limited to additions: modifications are not allowed.
- Pattern #1: Promote a step-by-step migration by using the Strangler application model
- Pattern #2: Testing dependencies
- Pattern #3: Single or multi-repository pattern
- Pattern #4: Data migration
- Pattern #5: Have the changes approved by people close to the problems

My book DevOps Patterns Guide on Amazon
https://www.amazon.com/DevOps-Patterns-Guide-Bruno-Delb-ebook/dp/B08QSMX9LC
More articles on my blog http://www.DevOpsTestLab.com.
My DevOpsTestLab Youtube channel.
My LinkedIn profile: https://fr.linkedin.com/in/brunodelb