【发布时间】:2015-03-25 13:24:13
【问题描述】:
救命!!
我正在尝试将我的生产代码推送到 heroku,但由于某种原因 heroku run rake db:migrate 命令不起作用。它给了我这个错误:
Migrating to RemoveMealPlanFromOrders (20150125085531)
== 20150125085531 RemoveMealPlanFromOrders: migrating =========================
-- remove_reference(:orders, :mealplan, {:index=>true})
PG::Error: ERROR: column "mealplan_id" of relation "orders" does not exist
: ALTER TABLE "orders" DROP "mealplan_id"
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::Error: ERROR: column "mealplan_id" of relation "orders" does not exist
: ALTER TABLE "orders" DROP "mealplan_id"/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `exec'
...
我已经拼命尝试了所有方法,包括手动删除错误引用的迁移文件、运行rake db:reset、重置heroku 的数据库甚至重新启动heroku 应用程序,但无济于事。如果有人能提供解决此错误的方法,我将不胜感激。我需要在截止日期前提交此生产代码。
提前致谢!!!
【问题讨论】:
-
您缺少迁移(在其中添加了 mealplan_id)
-
你的意思是我缺少迁移? mealplan_id 不再存在,因为我删除了它与另一个模型的关联。
-
错误是说引用已经在 POstgres 中删除了
标签: ruby-on-rails ruby postgresql heroku