0
簡而言之,我有一個與Devise的Rails API,我想將它部署到Heroku,以便我可以在React應用程序中使用json文件。當我嘗試將其遷移到Heroku時,它給了我錯誤:部署到Heroku PG :: DuplicateColumn:錯誤:
「PG :: DuplicateColumn:ERROR:關係」評論「的列」user_id「已存在 :ALTER TABLE」reviews「ADD」user_id「整數「
有人告訴我刪除遷移文件,因爲不知何故Devise已經使他們和遷移文件將使他們雙?無論如何,這並沒有幫助。
我不知道,如果你需要它,但是這是我的架構文件看起來像:
ActiveRecord::Schema.define(version: 20160719152952) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "games", force: :cascade do |t|
t.string "title"
t.text "description"
t.integer "review_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
add_index "games", ["review_id"], name: "index_games_on_review_id", using: :btree
create_table "reviews", force: :cascade do |t|
t.integer "rating"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.integer "user_id"
t.integer "game_id"
end
add_index "reviews", ["game_id"], name: "index_reviews_on_game_id", using: :btree
add_index "reviews", ["user_id"], name: "index_reviews_on_user_id", using: :btree
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "authentication_token", limit: 30
end
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
add_foreign_key "games", "reviews"
add_foreign_key "reviews", "games"
add_foreign_key "reviews", "users"
end
好像你有一個遷移到審查表中添加USER_ID –
是較早它給了我一個錯誤,它找不到USER_ID,和我做了一個遷移用戶添加到審查,因爲審查屬於給用戶。那時它確實解決了這個問題,但這不是正確的方法嗎? – Jakeroo