DB Migrate 未反映在 Heroku 上
我最近创建了一个在本地运行良好的数据库迁移。我推送到 heroku 并运行,
heroku rake db:migrate
虽然该命令似乎没有抛出错误,但我可以看到数据库尚未使用我尝试添加到表中的列进行更新。我尝试运行 heroku rake db:setup
但无济于事。此外,我还尝试在这两个命令后重新启动heroku,但它仍然不起作用。
以前有人遇到过这个问题吗?
I recently created a db migration which works fine locally. I pushed to heroku and ran
heroku rake db:migrate
Whilst the command doesn't seem to throw an error, I can see the database hasn't been updated with the column I've tried to add to a table. I've tried running heroku rake db:setup
but to no avail. Additionally, I've also tried restarting heroku after both commands but it still doesn't work.
Anybody have this problem before?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先尝试使用
heroku rake db:migrate:up VERSION=xxx
进行具体说明我遇到了类似的问题,我所做的就是重置数据库,如果这不起作用,我会向下迁移所有迁移(一一)并再次将它们添加起来,当然前提是您有能力丢失所有数据,或者下载数据库并进行调查。我在重新创建数据库时遇到的问题与我正在更改迁移以及在 Heroku 中我有一个共享数据库这一事实有关。
First try to be specific with
heroku rake db:migrate:up VERSION=xxx
I had similar problems and what I did was to reset the database, if that doesn't work, I would migrate down all migrations (one by one) and add them up again, of course only if you can afford to loose all your data, alternatively download the database and investigate. The problems I had with recreating the db were related to the fact that I was changing the migrations and that in heroku I had a shared database.