什么会导致 db:rollback 失败?
我正在尝试回滚我的rails3 数据库(postgresql)几个步骤以进行一些更改。
我今天添加了一个迁移文件。 rake db:rollback 成功回滚。
我现在尝试进一步返回,但 rake db:rollback 似乎不起作用。
运行 db:rollback 并进行跟踪,我得到
(in /rails/app/path/railsapp)
** Invoke db:rollback (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:rollback
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
但没有任何迹象表明创建已恢复或表已被删除。
我似乎找不到太多关于此的信息,所以我想知道 - 什么会导致 db:rollback 失败?
还有其他人遇到过这种情况吗?
I'm trying to rollback my rails3 database (postgresql) a few steps to make some changes.
I added a migration file today. rake db:rollback successfully rolled back.
I'm now trying to go back further, but rake db:rollback doesn't appear to be working.
running db:rollback with a trace, I get
(in /rails/app/path/railsapp)
** Invoke db:rollback (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:rollback
** Invoke db:schema:dump (first_time)
** Invoke environment
** Execute db:schema:dump
but no indication that a creation has reverted or a table has been dropped.
I can't seem to find much info on this, so I'm wondering - what can cause a db:rollback to fail?
Has anyone else encountered this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我将在这里回答我自己的问题,并将我未能看到显而易见的事情归咎于晚上工作太晚!
不知何故,我删除了一个不应该删除的迁移文件。显然Rails找不到它期望的迁移,因此回滚失败。
解决方案?
值得庆幸的是,有问题的迁移仍然在垃圾箱中。恢复。回滚。完毕!
I'll answer my own question here, and blame my failure to see the obvious on working too late at night!
Somehow I had deleted a migration file I wasn't supposed to. Obviously Rails couldn't find the migration it expected, and so the rollback failed.
Solution?
Thankfully the migration in question was still in the trash. Restore. Rollback. Done!