Rails migrations with no downtime
pedro.herokuapp.com
Rails migrations with no downtime
1–10 of 22 posts
Re: Rails migrations with no downtime
#2Re: Rails migrations with no downtime
#3Re: Rails migrations with no downtime
#4Re: Rails migrations with no downtime
#5Re: Rails migrations with no downtime
#6Re: Rails migrations with no downtime
#7If you're writing your code to work against multiple schemas, how do you test it? Do you run your test suite twice, once with the pre-migration schema, and again with the post-migration schema?
Most of the time migrations are developed in a feature branch, so the owner is responsible for splitting his branch into two or three before sending pull requests (as many as required to address issues with hot compatibility).
This means that we have two or more merges (and deploys) from master, each requiring a full run of the test suite.
Re: Rails migrations with no downtime
#8What's the Django equivalent of this?
I'd also recommend using South for migrations http://south.aeracode.org/
Re: Rails migrations with no downtime
#9This is old news, but we successfully use https://github.com/freels/table_migrator in production not on heroku. It creates a copy of the table, performs the schema changes, copies the data over, then renames the tables for almost (i.e. 1-2 seconds) no downtime.
The Percona pt-online-schema-change tool goes to great lengths to avoid this kind of problem.
Re: Rails migrations with no downtime
#10Running migrations on live databases with lots of data in them is hard. There are many strategies to work around this problem, but generally running an 'alter table' on your primary db server on a huge table while it is in use should be your very last option.