的database.yml耙分貝:遷移錯誤:db_development.locations'不存在:SHOW FULL FIELDS FROM`locations`
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: db_development
username: root
password: "123"
socket: /var/run/mysqld/mysqld.sock
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: db_test
pool: 5
username: root
password: "123"
socket: /var/run/mysqld/mysqld.sock
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: db_production
pool: 5
username: root
password: "123"
socket: /var/run/mysqld/mysqld.sock
我安裝了寶石mysql2
我在MySQL控制檯創建的數據庫。
後運行耙分貝:從locations
一個遷移從遷移SHOW FULL FIELDS:遷移並顯示錯誤:db_development.locations'不存在
class CreateLocations < ActiveRecord::Migration
def self.up
create_table :locations do |t|
t.string :name
t.string :type
t.integer :parent_id
t.integer :position
t.timestamps
end
end
def self.down
drop_table :locations
end
end
什麼錯誤,以及如何解決這個問題?
請檢查您的遷移文件。一些遷移可能指的是位置。因此,請按遷移架構ID的順序進行檢查。其中一項遷移必須是在創建位置表格遷移 – Andolasoft
之前提及的遷移示例。什麼是不正確的? – Dmitrij
只需檢查可能涉及位置的其他遷移。當前的遷移文件是正確的。您應該檢查在此遷移文件 – Andolasoft