Introducing Post Deployment Migration

As of https://github.com/discourse/discourse/commit/40fa96777ddad4698df20d6b8a61afcf87743ed7, we’re moving away from our delayed drop pattern to remove a column from a table in the database. Inspired by Gitlab’s pattern of post deployment migration, we’ve added the ability to generate and run migrations that can be run after a deployment.

SKIP_POST_DEPLOYMENT_MIGRATIONS=1 rake db:migrate
-> deploy app servers
SKIP_POST_DEPLOYMENT_MIGRATIONS=0 rake db:migrate

To generate a post deployment migration, simply run rails generate post_migration followed by the same arguments as you would for the default rails migration generator.

18 Likes