I have an error in my migrations for a fresh application. The app has over 30 migrations, and one of them is causing an error.
Is there a way to migrate five at a time in order to s开发者_JAVA百科pin through the migrations faster than doing each one individually?
If you specify the version you want to get to, it will run the set of migrations that leads up to that version. The version is the numerical prefix on your migration name.
So if you have this set of migrations:
12345_do_a.rb
23456_do_b.rb
45678_do_c.rb
56789_do_d.rb
and you just wanted to run the first two, you can do
rake db:migrate VERSION=23456
and it will run the necessary migrations to get to that version (i.e. the first two). Then you could target a later version to run the next group, etc.
精彩评论