rake db:migrate
sqlite3
本地工作,但在heroku中不工作postgresql
。PG :: UndefinedTable:错误:关系“音乐家”不存在
错误
PG::UndefinedTable: ERROR: relation "musicians" does not exist
: ALTER TABLE "orders" ADD CONSTRAINT "fk_rails_ad134589be"
FOREIGN KEY ("musician_id")
REFERENCES "musicians" ("id")
(0.9ms) ROLLBACK
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedTable: ERROR: relation "musicians" does not exist
: ALTER TABLE "orders" ADD CONSTRAINT "fk_rails_ad134589be"
FOREIGN KEY ("musician_id")
这里是整个日志的链接:https://gist.github.com/helloravi/2cb69e0927e63e186b09
下面是没有得到执行迁移。显示错误下面的迁移代码
class CreateAlbums < ActiveRecord::Migration
def change
create_table :albums do |t|
t.string :album_name
t.references :musician, index: true, foreign_key: true
t.timestamps null: false
end
add_foreign_key :albums, :users, column: :musician_id
end
end
我有一个音乐家列是布尔(有些用户音乐家)
我甚至使用add_foreign_key
尝试,仍然我不能图users表解决问题是什么。
我试图rake db:schema:load
和它的工作。我希望能够使rake db:migrate
工作,因为我需要能够在生产中迁移。
您运行'heroku运行耙db:migrate'? – Pavan
这就是不工作帕 –
难道你还贴在'应用程序/模型/ album.rb'协会的一部分? –