If I have two migrations, mig1 and mig2, I run rake db:migrate, then I go back to mig1 and change the default value of a column, will this change be reflected when I run rake db:migrate again? Or do I have to make a new migration just for that column to make the change?
+1
A:
You should either make a new migration or use the rake db:rollback
task to move back to the version of your database before the migration in question was ran. Changes to migration scripts won't be automatically picked up.
The current version of your schema is tracked and applied to migrations, so running rake db:migrate will not rerun old migrations. It is for this reason that you are able to use the rollback
feature, as long as you provided correct self.down
methods on your migration. Rolling back executes these down methods, undoing the migrations as it goes.
You can then edit the migration and re-migrate.
Zachary
2010-08-05 19:45:55
thanks - I needed to make a new migration.
crakalakin
2010-08-12 14:57:50