Introducing Post Deployment Migration


(Alan Tan) #1

As of FEATURE: Post deployment migrations. (#6406) · discourse/discourse@40fa967 · GitHub, 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.