ActiveRecord :: PendingMigrationError:迁移正在等待处理。要解决此问题,请运行:bin / rake db:migrate RAILS_ENV = development

时间:2015-12-09 23:22:10

标签: ruby-on-rails ruby activerecord migration

NEWBIE:我正在尝试设置我网站的会员资格部分。我运行了以下命令:

git checkout development 
git merge user_authentication 
git checkout -b stripe_integration 
bundle exec rails g migration CreatePlans

并收到此错误:

ActiveRecord::PendingMigrationError: Migrations are pending. To
resolve this issue, run: bin/rake db:migrate RAILS_ENV=development

我尝试过运行它和其他命令但没有成功。下面是该问题的其他Stack Overflow答案的链接,这些答案对我不起作用并且完整跟踪。

Link from Stack Overflow 1

Link from Stack Overflow 2

完整追踪:

kmcrayton7:~/workspace (stripe_integration) $ bin/rake db:migrate RAILS_ENV=development
== 20151209220651 AddDeviseToUsers: migrating =================================
-- change_table(:users)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

SQLite3::SQLException: duplicate column name: email: ALTER TABLE "users" ADD "email" varchar(255) DEFAULT '' NOT NULL/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `initialize'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `new'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `prepare'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:134:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:331:in `block in execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:331:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:454:in `add_column'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:490:in `block (3 levels) in <class:Table>'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (2 levels) in <class:Table>'
/home/ubuntu/workspace/db/migrate/20151209220651_add_devise_to_users.rb:5:in `block in up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:349:in `change_table'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:649:in `block in method_missing'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `block in say_with_time'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `say_with_time'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:641:in `method_missing'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:406:in `method_missing'
/home/ubuntu/workspace/db/migrate/20151209220651_add_devise_to_users.rb:3:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:558:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:598:in `exec_migration'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:578:in `block in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:577:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:752:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `block in transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:219:in `within_new_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `ddl_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:953:in `block in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:807:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:785:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `block in load'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
-e:1:in `<main>'
ActiveRecord::StatementInvalid: SQLite3::SQLException: duplicate column name: email: ALTER TABLE "users" ADD "email" varchar(255) DEFAULT '' NOT NULL
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `initialize'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `new'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `prepare'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:134:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:331:in `block in execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:331:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:454:in `add_column'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:490:in `block (3 levels) in <class:Table>'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (2 levels) in <class:Table>'
/home/ubuntu/workspace/db/migrate/20151209220651_add_devise_to_users.rb:5:in `block in up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:349:in `change_table'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:649:in `block in method_missing'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `block in say_with_time'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `say_with_time'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:641:in `method_missing'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:406:in `method_missing'
/home/ubuntu/workspace/db/migrate/20151209220651_add_devise_to_users.rb:3:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:558:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:598:in `exec_migration'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:578:in `block in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:577:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:752:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `block in transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:219:in `within_new_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `ddl_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:953:in `block in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:807:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:785:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `block in load'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
-e:1:in `<main>'
SQLite3::SQLException: duplicate column name: email
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `initialize'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `new'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `prepare'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:134:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:331:in `block in execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:331:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:454:in `add_column'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:490:in `block (3 levels) in <class:Table>'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (2 levels) in <class:Table>'
/home/ubuntu/workspace/db/migrate/20151209220651_add_devise_to_users.rb:5:in `block in up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:349:in `change_table'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:649:in `block in method_missing'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `block in say_with_time'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `say_with_time'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:641:in `method_missing'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:406:in `method_missing'
/home/ubuntu/workspace/db/migrate/20151209220651_add_devise_to_users.rb:3:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:558:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:598:in `exec_migration'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:578:in `block in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:577:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:752:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `block in transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:219:in `within_new_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `ddl_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:953:in `block in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:807:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:785:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `block in load'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
-e:1:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

我应该从add_devise_to_user.rb文件中删除哪个电子邮件?

class AddDeviseToUsers < ActiveRecord::Migration
  def self.up
    change_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


      # Uncomment below if timestamps were not included in your original model.
      # t.timestamps
    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

  def self.down
    # By default, we don't want to make any assumption about how to roll back a migration when your
    # model already existed. Please edit below which fields you would like to remove in this migration.
    raise ActiveRecord::IrreversibleMigration
  end
end

1 个答案:

答案 0 :(得分:1)

查看AddDeviseToUsers迁移错误堆栈跟踪,您可能会注意到您有一个重复的电子邮件列。您已在users表上有一个电子邮件列,并且特定的迁移正在尝试添加另一个。

我建议您编辑AddDeviseToUsers以删除电子邮件列创建。如果您不熟悉Rails目录结构,可以在db/migrate/xxxxxxxxxxx_add_devise_to_users.rb

找到该文件

我希望它有所帮助。