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.

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.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store