Play Defense With Production Migrations

A Rails fallback solution for migrating data

Andy Huynh

2 minute read

Let’s say we have an Account class with an address column. We got word a home address AND a work address is in play. Apparently addresses in our app are complex creatures and we have a has_one/belongs_to relationship. We’ll have to rename and add a column. Renaming the column is the point of this post and it will get tricky, especially with production data. When migrating data, we have a short window where Heroku will take roughly 60 seconds to migrate the data.