非常奇怪的問題無法遷移/種子數據庫 - Postgres的Rails的
我試圖轉移我的數據庫,但我不斷收到:
PG::UndefinedTable: ERROR: relation "users" does not exist
這裏是我的移民:
class AddRoleToUser < ActiveRecord::Migration
def up
add_column :users, :role_id, :integer
end
def down
remove_column :users, :role_id
end
end
我的模式:
ActiveRecord::Schema.define(version: 20140205191602) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
create_table "horseraces", force: true do |t|
t.integer "horse_id"
t.integer "race_id"
t.datetime "entered"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "horses", force: true do |t|
t.string "name"
t.string "gender"
t.date "DOB"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "races", force: true do |t|
t.string "name"
t.integer "race_number"
t.string "description"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "roles", force: true do |t|
t.string "name"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "users", force: true do |t|
t.string "first_name"
t.string "last_name"
t.string "user_name"
t.string "address"
t.string "phone_number"
t.string "email", default: ""
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.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "role_id"
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
end
我一直在努力:
rake db:reset
和
rake db:drop
rake db:create
rake db:migrate
和我每次都遭到了同樣的錯誤。
有趣的是,這是工作,這意味着我已經運行這些命令,並得到它的工作。我只是試圖剛剛開始,現在它拋出這些錯誤。
值得注意 - 我確實將users.rb的模型文件更改爲user.rb & roles.rb更改爲role.rb我不知道這是否會影響任何內容。
任何幫助將不勝感激。
請發佈您的config/database.yml文件 – eabraham