rake db: migrate дает ошибку

Я просто пытался мигрировать, но моя консоль возвращает это

StandardError: Произошла ошибка, эта и все последующие миграции были отменены:

SQLite3 :: SQLException: дублированное имя столбца: encrypted_password: ALTER TABLE "users" ADD "encrypted_password" varchar DEFAULT '' NOT NULL

Я понимаю, что я случайно создал таблицу дважды и мне нужно внести изменения в файл миграции? Если да, где я могу его найти? Отбросить всю базу данных было бы хорошим решением, тоже в моем случае.

Мне просто нужно знать, как это сделать. Все решения, которые я нашел до сих пор, не работали для меня.

ОБНОВЛЕНИЕ: Когда я

rake db: migrate: down ВЕРСИЯ = 20160914093125

Консоль говорит

== 20160914093125 DeviseCreateUsers: revertting ===================================: reset_password_token}) → 0.0013s - remove_index (: users, {: column =>: email}) → 0.0006s - drop_table (: users) → 0.0003s == 20160914093125 DeviseCreateUsers: reverted (0.0025s) = ======================

Являются ли эти моменты я должен измениться?

3123 (...) devise_create_user.rb

class DeviseCreateUsers < ActiveRecord::Migration[5.0]
  def change
    create_table :users do |t|
      ## Database authenticatable
      t.string :email,              null: false, default: ""
      t.string :encrypted_password, null: false, default: ""

      ## Recoverable
      t.string   :reset_password_token
      t.datetime :reset_password_sent_at

      ## Rememberable
      t.datetime :remember_created_at

      ## Trackable
      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

      ## Confirmable
      # t.string   :confirmation_token
      # t.datetime :confirmed_at
      # t.datetime :confirmation_sent_at
      # t.string   :unconfirmed_email # Only if using reconfirmable

      ## Lockable
      # t.integer  :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
      # t.string   :unlock_token # Only if unlock strategy is :email or :both
      # t.datetime :locked_at


      t.timestamps null: false
    end

    add_index :users, :email,                unique: true
    add_index :users, :reset_password_token, unique: true
    # add_index :users, :confirmation_token,   unique: true
    # add_index :users, :unlock_token,         unique: true
  end
end

Консоль после попытки миграции:

== 20160915185631 AddDeviseToUsers: мигрировать ================================= - change_table (: users) rake aborted! StandardError: Произошла ошибка, эта и все последующие миграции были отменены:

SQLite3 :: SQLException: нет такой таблицы: пользователи: ALTER TABLE "users" ADD "email" varchar DEFAULT '' NOT NULL/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb: 91: in initialize'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in new'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in prepare'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:134:in execute '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb: 232: в block in execute'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:566:in блоке в журнале '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/notifications/instrumenter.rb21:in instrument'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:560:in instrument'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:560:in журнале '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in execute'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:547:in add_column '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:373:in add_column'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:475:in столбце '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord -5.0.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb: 181: в block in string'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:181:in каждом '/Us ers/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb: 181: в string'/Users/matthiascordes/code/recipe_box/db/migrate/20160915185631_add_devise_to_users.rb:5:in block in up '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_statements.rb: 443: in change_table'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:845:in блоке в method_missing'/Users/matthiascordes/. rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb: 814: в block in say_with_time'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:814:in say_with_time '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration. rb: 834: in method_missing'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:596:in method_missing'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:596:in method_missing '/Users/matthiascordes/code/recipe_box/db/migrate/20160915185631_add_devise_to_users.rb:3:in up'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:751:in up '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration. rb: 791: in exec_migration'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:772:in block (2 уровня) в migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:771:in block in migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in with_connection '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord- 5.0.0.1/lib/active_record/migration.rb:770:in migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:950:in migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:950:in migrate '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1211:in block in execute_migration_in_transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1279:in блоке в ddl_transaction '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb: 232: в block in transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:189:in inside_new_transaction '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:211:in transaction'/Пользователи /matthiascordes/.rvm/драгоценные камни/рубиновый 2.3.1/камни /ActiveRecord-5.0.0.1/Library/ACTi ve_record/migration.rb: 1279: in ddl_transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1210:in execute_migration_in_transaction'/Пользователи /matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1183:в block in migrate_without_lock'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1182:in каждом '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb: 1182: in migrate_without_lock'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1133:in migrate'/Пользователи /matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1005:in up'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:983:in migrate '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_re cord/tasks/database_tasks.rb: 161: in migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/railties/databases.rake:58:in блок (2 уровня) в '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/rake-11.2.2/exe/rake:27:in <top (required)>'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in eval '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in <main>' ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: users: ALTER TABLE "users" ADD "email" varchar DEFAULT '' NOT NULL/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in initialize '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in new'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in prepare'/Users/matthiascordes/.rvm/gems/ruby -2.3.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb: 134: in execute'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in execute'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in блоке в execute '/Users/matthiascordes/.rvm/gems/ruby- 2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract_adapter.rb: 566: в block in log'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/notifications/instrumenter.rb:21:in инструменте '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract_adapter. rb: 560: in log'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in execute'/Пользователи /matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:547:in add_column'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:373:in add_colu mn '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:475:in column'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:181:in блоке в строке '/Users/matthiascordes/.rvm/gems/ruby-2.3. 1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb: 181: в each'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:181:in string '/Users/matthiascordes/code/recipe_box/db/migrate/20160915185631_add_devise_to_users.rb:5:в block in up'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:443:in change_table '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:845:в block in method_missing'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:814:in block in method_missing'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:814:in блоке в say_with_time'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb: 814: in say_with_time'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:834:in method_missing '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:596: в method_missing'/Users/matthiascordes/code/recipe_box/db/migrate/20160915185631_add_devise_to_users.rb:3:in up'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:751:in up'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:791:in exec_migration'/Пользователи /matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb: 772: в block (2 levels) in migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:771:in block (2 levels) in migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:771:in block in migrate '/Users/matthiascordes/.rvm/gems/ruby-2.3. 1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb: 398: in with_connection'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:770:in migrate '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:950:in migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1211:in блоке в execute_migration_in_transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb: 1279: в block in ddl_transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in блоке в транзакции '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/ activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb: 189: in within_new_transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in transaction '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:211:in transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1279:in ddl_transaction'/Users/matthiascordes/.rvm/gems/ruby- 2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb: 1210: in execute_migration_in_transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1183:in блоке в migrate_without_lock '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1182: в each'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1182:in each'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1182:in migrate_without_lock '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1133:in migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1005:in up '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:983:in migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/tasks/database_tasks.rb:161:in migrate '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/railties/databases.rake:58:in block (2 levels) in <top (required)>'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/rake-11.2.2/exe/rake:27:in '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in eval'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in ' SQLite3 :: SQLException: нет такой таблицы: пользователи /Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/ sqlite3-1.3.11/lib/sqlite3/database.rb: 91: in initialize'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in новых '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in prepare'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:134:in execute '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord- 5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in block in execute'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:566:in блоке в журнале '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activesupport-5.0.0.1/lib/active_support/notifications/instrumenter.rb21:in instrument'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract_adapter.rb:560:in log'/Users/matthiascordes/.rvm/gems/рубиновый 2.3.1/драгоценные камни /ActiveRecord-5.0. 0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb: 232: in execute'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:547:in add_column '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:373:in add_column'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:475:in столбце '/Users/matthiascordes/.rvm/gems/ruby- 2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb: 181: в block in string'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb:181:in каждом '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_definitions.rb: 181: в string'/Users/matthiascordes/code/recipe_box/db/migrate/20160915185631_add_devise_to_users.rb:5:in string'/Users/matthiascordes/code/recipe_box/db/migrate/20160915185631_add_devise_to_users.rb:5:in блоке в up '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:443:in change_table'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:845:in блоке в method_missing '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:814:в block in say_with_time'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:814:in say_with_time '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb: 834: in method_missing'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:596:in method_missing '/Users/matthiascordes/code/recipe_box/db/migrate/20160915185631_add_devise_to_users.rb:3:in up'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:751:in up'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:751:in up '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb: 791: in exec_migration'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:772:in блоке (2 уровня) в migrate '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:771: в block in migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in with_connection'/Users/matthiascordes/. rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb: 770: in migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:950:in migrate '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb: 1211: в block in execute_migration_in_transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1279:in block in execute_migration_in_transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1279:in блоке в ddl_transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:232:в block in transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/transaction.rb:189:in inside_new_transaction '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/transactions.rb:211:in транзакции '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1279:in ddl_transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1210:in ddl_transaction'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1210:in execute_migration_in_transaction '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1183:в block in migrate_without_lock'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1182:in каждом '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb: 1182: in migrate_without_lock'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1133:in migrate '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:1005:in up'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/migration.rb:983:in migrate '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/tasks/database_tasks.rb:161:in migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/railties/databases.rake:58:in migrate'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/activerecord-5.0.0.1/lib/active_record/railties/databases.rake:58:in блоке (2 уровня) в '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/gems/rake-11.2.2/exe/rake:27:in <top (required)>'/Users/matthiascordes/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in eval '/Users/matthiascordes/.rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in' '

-1
источник поделиться
2 ответа

Если вы знаете файл миграции, который хотите вернуть назад, используйте это,

For eg, if this is the migration file,
20123219103503_add_name_field_to_user.rb

затем скопируйте номера в файл, а затем запустите в командной строке терминала следующее:

rake db:migrate:down VERSION=20123219103503

создавать выпуски в файлах миграции, а затем запускать

rake db:migrate

от терминала

0
источник

Возможно, вы изменили схему базы данных вручную или изменили файл миграции.

Если вам не нужны данные в базе данных, rake db:reset будет перезапускать все миграции с нуля.

Вы также можете попытаться перенести свою базу данных на версию 0 с помощью команды: rake db:migrate VERSION=0 а затем запустить rake db:migrate


Если вы хотите удалить всю базу данных, как вы заявили, вы можете выполнить одно из следующих действий:

rake db:drop просто отбрасывает всю базу данных.

rake db:reset db:migrate сбрасывает вашу базу данных и перезагружает текущую схему.

rake db:drop db:create db:migrate уничтожит вашу базу данных, а затем создаст ее, а затем перенесет вашу текущую схему.

Все данные будут потеряны в вышеуказанных трех сценариях.


Вы также можете прокомментировать метод в файле миграции, а затем запустить rake db:migrate как rake db:migrate ниже:

Файл нормальной миграции:

class AddEncryptedPaddwordToUsers < ActiveRecord::Migration
  def change
    add_column :users, :encrypted_password, :string
  end
end

Просто закомментируйте метод, но оставьте класс, так что это будет:

class AddEncryptedPaddwordToUsers < ActiveRecord::Migration
  # def change
  #   add_column :users, :encrypted_password, :string
  # end
end

Затем запустите rake db:migrate. По сути, это работа, которая говорит, что рельсы пропускают миграцию

0
источник

Посмотрите другие вопросы по меткам или Задайте вопрос