I have a very large amount of migration files that need to run and some of them apparently are outdated. For example:
This fails:
def self.up
create_table(:users) do |t|
t.database_authenticatable :null => false
...
With this error:
-- create_table(:users)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
undefined method `database_authenticatable' for #<ActiveRecord::ConnectionAdapters::TableDefinition
I assume because Devise was updated at the time of writing this.
What else can I do?
It turns out there's a schema file. Here's part of it:
ActiveRecord::Schema.define(version: 20160221211458) do
create_table "activities", force: true do |t|
t.integer "user_id", null: false
t.string "target_type", default: "", null: false
t.integer "target_id", null: false
t.string "action", default: "", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "activities", ["target_id"], name: "index_activities_on_target_id_and_target_type", using: :btree
add_index "activities", ["user_id"], name: "index_activities_on_user_id", using: :btree
create_table "addresses", force: true do |t|
...
What's the difference between doing bundle exec rake db:schema:load
vs trying to run the migrations. Is there a difference between the two?
Also, this database is a mysql database:
# SQLite version 3.x
# gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: mysql2
database: arthouse_development
username: root
password:
host: localhost
port: 3306
#socket: /tmp/mysql.sock
How do I see this database after running bundle exec rake db:schema:load