Database Deployments with Reduced Downtime


Once your application or service is running in production you have a lot more to consider when making database changes. It can be tricky, here are a few things to keep in mind that should reduce or eliminate downtime.

Renaming Columns

If you need to rename a column, to reduce downtime you cannot do the rename all in one release. Let’s say that we want to rename firstName to first_name in our users table. Assuming there is already data in that column in our database we need to take a 3 step approach to complete the renaming process.


  1. Create a new first_name column (keeping the old firstName column)
  2. Ensure application is writing to both columns. Perform a backfill, copying values from the old firstName column to the new first_name column
  3. Cleanup. Once all data has been copied (may require several runs of the backfill), update application to only write to new first_name column. Delete old firstName column.

Adding Columns

If you’re adding columns, start with updating the database with the new column. If you intend for the new column to not allow for NULL values you will need to ensure a default value is supplied when creating the column. After the database has been updated then we can deploy new application or service code to use the new column.

Removing Columns

If you need to remove a column we need to configure application or service code to no longer use the old column. Once we deploy our code changes then we can remove the old column.