开发者

how to use rake db:migrate

I just want to roll one vers开发者_如何学Goion back, But I don't know the current VERSION, Is there a command to check it?


First, it's worth taking the time to read the Rails Guide regarding migrations. Then regarding your specific question:

... to roll back one version:

rake db:rollback STEP=1

... to see the current version:

rake db:version


VERSION essentially is the name of a specific migration and not a point in time. You need to roll back multiple such “versions” to get back in time. These versions have the same names as the file names in db/migrate (without extension). This can be used to roll back a specific migration without undoing migrations done later.

Use the STEP parameter to go back in time a specified amount of migration steps.


Migrations are timestamped. It is safe to assume that the latest timestamp is the current migration in most instances.

http://guides.rubyonrails.org/migrations.html#rolling-back

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜