Ruby-on-rails rails 运行特定的迁移
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1316889/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 21:39:29 来源:igfitidea点击:
rails run specific migration
提问by Daniel
I've deleted a table in the database, call it X. db:migrate no longer works. I have a migration file called CreateX. Is there a way to run just that specific migration?
我删除了数据库中的一个表,称之为 X。db:migrate 不再有效。我有一个名为 CreateX 的迁移文件。有没有办法只运行那个特定的迁移?
回答by JP Silvashy
rake db:migrate:redo VERSION=my_version
Or you can go up or down from a specific version:
或者您可以从特定版本上升或下降:
db:migrate:up VERSION=my_version
db:migrate:down VERSION=my_version

