Migrations: best practices

In AWDWR v2 there are two high-level paths for migrations suggested:

  1. Have a new migration file for each schema change that arises during
    the course of development. Theoretically, this enables one to update
    the schema in any of the environments, even production.
  2. Have a migration file for each table. This is offered as a way to
    maintain a view of the schema in a single location, but seems to
    abandon all hope of running the migrations against production.

I’d like to throw out a third option: have a single migration file for
each release. This way the changes that are collectively required for
the release are in a single location, and the migration can be run to
update production. If you need a readable document showing the current
state of the schema, then update the schema.rb file.

I’m new to RoR, and to this list, so it’s very likely that this option
has already seen a good deal of discussion (although I didn’t see
anything in a quick scan of the archive). If this has already been
beaten to death, then point me in the direction of the carcass.



Michael Kelly
Team Lead, Applications Group

Hi Michael

I am not sure whether this would be useful to you but I wrote an
article on moving a legacy database to Rails in my blog.