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'協會的一部分? –