开发者

Is it possible to migrate a series of migrations at one time?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜