DB Migrate 未反映在 Heroku 上

发布于 2024-12-07 12:29:57 字数 247 浏览 0 评论 0原文

我最近创建了一个在本地运行良好的数据库迁移。我推送到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

放飞的风筝 2024-12-14 12:29:57

首先尝试使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文