Rails Migrations and Subversion

Rails Migrations and Subversion

Paul Pagel
Paul Pagel

September 28, 2006

In rails, migrations are generated in such a way that they create a numbered migration with an up and a down schema direction. This has been incredibly helpful when dealing with the schema changes:

paul-pagels-computer:~/RailsProjects/project paulpagel$ ruby script/generate migration CreatePacketTimestamp exists db/migrate create db/migrate/013createpacket_timestamp.rb

The problem our team has found is doing migrations with subversion.

This creates a numbered migration with an up and a down schema direction. This has been incredibly helpful when dealing with the schema changes. The problem our team has found is doing migrations with subversion.

You run migrations by:

paul-pagels-computer:~/RailsProjects/project paulpagel$ rake migrate

Which looks in the schema_info table to find which version of the schema your database is representing, and updates it to the most recent version (the highest number).

The problem comes into play when you have multiple people making migration scripts on their local machine at the same time. If two different people did a migration at the same time and committed them you would end up with two migrations. Which one gets run?

I am not sure how to solve this one yet. I have been loving rails, but this has already has put a dampener on it.