At OmbuLabs
opens a new window
, we are big fans of Ruby on Rails
opens a new window
and design patterns
opens a new window
, especially convention over configuration
opens a new window
! The beauty of Rails is that
you can inherit a legacy project and easily find the different layers of code
in different directories.
When it comes to database migrations the policy of Rails is very clear. It’s all
about altering the database structure with gradual migration files:
“Migrations are a convenient way to alter your database schema over time in a
consistent and easy way.” (source
opens a new window
)
But, what about data migrations? What’s the best way to write, maintain, and run
migrations that alter the data in your production database?
In this article I will talk about three different patterns for writing and
maintaining your data migrations:
- Data migrations in
db/migrate
- Data migrations with a set of Rake tasks
- Data migrations with
data_migrate
Read more
opens a new window