rake db:migrate 手动为一个文件提供迁移
不知何故,我的测试环境忘记复制多个迁移。为了排除故障,我想手动调用某些迁移文件。
是否有 rake db:migrate 选项或技巧允许我传递一个充满应该运行的迁移的目录?或者甚至是要运行的特定迁移文件?
这些迁移不存在于 db/migrate/
下,而是存在于另一个 gems 的迁移文件夹中 (/home/ber/.rvm/gems/ruby-1.8.7-p302@xxx/ gems/spree_auth-1.0.0/db/migrate/
)。
Somehow my test environment forgot to copy over several migrations. In order to troubleshoot, I want to call certain migration files by hand.
Is there a rake db:migrate option or trick that allows me to pass in a directory full of migrations that should be ran? Or even a specific migration file that will be ran?
These migrations are not present under db/migrate/
, but rather in another gems' migration folder (/home/ber/.rvm/gems/ruby-1.8.7-p302@xxx/gems/spree_auth-1.0.0/db/migrate/
).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用特定版本生成迁移,则这篇文章将帮助您。
来自帖子:
其中
VERSION=
设置为您这一代的任何内容。If you generate your migrations with a specific version then this post will help you with that.
From post:
Where
VERSION=
is set to whatever comes from your generation.尝试运行此命令,
您会发现一个包含所有迁移的表,
选择您想要迁移或取消迁移的版本
然后
请注意,如果您陷入迁移过程中,这将不起作用,如果您必须注释掉已迁移的行
祝你好运
try running this
you will find a table with all your migrations
choose the version you would like to migrate or unmigrate
then
Notice that this won't work if you are stuck in mid migrations if you are you have to comment out the lines that were already migrated
Good luck