On Tue, Jul 15, 2008 at 04:39:29PM -0600, Sean C. Hess wrote:
Hi everybody, I’m trying to figure out the best way to do migrations.
I’m sure it’s a personal preference in some ways, but how do you prefer
to maintain migrations?
Do you create a new migration every time you think of a change, or do you
change the existing ones, then rake db:migrate to 0 and back again?
If you do the first, you don’t have to be constantly recreating your
tables, but your table code is all over the place. What do you all
If you’re working alone, you can often afford to be sloppy. Better,
is to be rigorous as if you were working with other people all the time.
That means a migration for every change. When you actually release
something (which usually involves tagging in subversion or whatever SCM
use) you can do a rake db:schema:dump to get a db/schema.rb file then
out your migrations and replace them with the contents of the schema.rb
a migration with the next version number).
Of course, if any of your migrations were doing straight SQL you may
to do some tweaking by hand.