Keep Database Deploys Separate

A while ago, I tweeted that you shouldn’t deploy database migrations at the same time as your app code. I thought I’d write something about why I feel this way, and the situations where I feel strongest about this.

This post has the structure of an Architecture Decision Record, because context matters. I think ADRs are an excellent way to force you to think about the context in which you make a decision, and I’m hoping to use the format to think about the context in which my recommendation applies.

The team that this recommendation applies most to has the following things going on:

  1. You are building a user-facing application, quite probably a web app for consumption by a browser or mobile native application.
  2. You have enough users that, whenever you deploy, most likely someone is using the app. Therefore, you employ techniques to deploy your app with zero downtime, such as deploying one app server at a time rather than all at once.
  3. You deploy your app multiple times a week (possibly even multiple times a day).
  4. You don’t have maintenance windows (for deployments or otherwise).

Read more at PhilandStuff