I'm trying to do a rake db:migrate on RoR. However after running the command I get the following error (I've included trace as well). Can you please tell me how it can be soled? I have tried to rollback and repeat the procedure but it's not working.... :
Malions-MacBook-Air:omrails malionhoxhallari$ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
== 20141128222329 AddDeviseToUsers: migrating =================================
-- change_table(:users)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: no such table: users: ALTER TABLE "users" ADD "email" varchar(255) DEFAULT '' NOT NULL/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:334:in `block in execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:334:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:457:in `add_column'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:490:in `block (3 levels) in <class:Table>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (2 levels) in <class:Table>'
/Users/malionhoxhallari/code/omrails/db/migrate/20141128222329_add_devise_to_users.rb:5:in `block in up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:349:in `change_table'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:649:in `block in method_missing'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `block in say_with_time'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `say_with_time'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:641:in `method_missing'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:406:in `method_missing'
/Users/malionhoxhallari/code/omrails/db/migrate/20141128222329_add_devise_to_users.rb:3:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:558:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:598:in `exec_migration'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:578:in `block in migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:577:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:752:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:991:in `block in execute_migration_in_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `block in ddl_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/transactions.rb:208:in `transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `ddl_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:990:in `execute_migration_in_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:952:in `block in migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:807:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:785:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:240:in `call'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:240:in `block in execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:235:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:235:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:165:in `invoke'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:156:in `invoke_task'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `block (2 levels) in top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `block in top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:121:in `run_with_threads'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:106:in `top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:84:in `block in run'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:182:in `standard_exception_handling'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:79:in `run'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/bin/rake:33:in `<top (required)>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/rake:23:in `load'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/rake:23:in `<main>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: users: ALTER TABLE "users" ADD "email" varchar(255) DEFAULT '' NOT NULL
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:334:in `block in execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:334:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:457:in `add_column'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:490:in `block (3 levels) in <class:Table>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (2 levels) in <class:Table>'
/Users/malionhoxhallari/code/omrails/db/migrate/20141128222329_add_devise_to_users.rb:5:in `block in up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:349:in `change_table'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:649:in `block in method_missing'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `block in say_with_time'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `say_with_time'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:641:in `method_missing'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:406:in `method_missing'
/Users/malionhoxhallari/code/omrails/db/migrate/20141128222329_add_devise_to_users.rb:3:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:558:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:598:in `exec_migration'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:578:in `block in migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:577:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:752:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:991:in `block in execute_migration_in_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `block in ddl_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/transactions.rb:208:in `transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `ddl_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:990:in `execute_migration_in_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:952:in `block in migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:807:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:785:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:240:in `call'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:240:in `block in execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:235:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:235:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:165:in `invoke'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:156:in `invoke_task'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `block (2 levels) in top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `block in top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:121:in `run_with_threads'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:106:in `top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:84:in `block in run'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:182:in `standard_exception_handling'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:79:in `run'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/bin/rake:33:in `<top (required)>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/rake:23:in `load'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/rake:23:in `<main>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
SQLite3::SQLException: no such table: users
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:334:in `block in execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:334:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:457:in `add_column'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:490:in `block (3 levels) in <class:Table>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (2 levels) in <class:Table>'
/Users/malionhoxhallari/code/omrails/db/migrate/20141128222329_add_devise_to_users.rb:5:in `block in up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:349:in `change_table'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:649:in `block in method_missing'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `block in say_with_time'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `say_with_time'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:641:in `method_missing'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:406:in `method_missing'
/Users/malionhoxhallari/code/omrails/db/migrate/20141128222329_add_devise_to_users.rb:3:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:558:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:598:in `exec_migration'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:578:in `block in migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:577:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:752:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:991:in `block in execute_migration_in_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `block in ddl_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/transactions.rb:208:in `transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `ddl_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:990:in `execute_migration_in_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:952:in `block in migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:807:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:785:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:240:in `call'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:240:in `block in execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:235:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:235:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:165:in `invoke'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:156:in `invoke_task'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `block (2 levels) in top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `block in top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:121:in `run_with_threads'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:106:in `top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:84:in `block in run'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:182:in `standard_exception_handling'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:79:in `run'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/bin/rake:33:in `<top (required)>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/rake:23:in `load'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/rake:23:in `<main>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate
Did you follow all the steps in the Devise readme(https://github.com/plataformatec/devise)?
Make sure you ran:
rails g devise:install
and
rails g devise User
before migrating.
Since the first part of the trace shows: SQLite3::SQLException: no such table: users so the first thing I would do is check the migration file and schema.rb to see if you've created the users table properly.
Here's an example of a working schema.rb and migration using Devise:
schema.rb:
create_table "users", force: true do |t|
t.string "email", default: "", null: false
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.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.string "role"
end
Corresponding migration to update schema:
class DeviseCreateUsers < ActiveRecord::Migration
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.inet :current_sign_in_ip
t.inet :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
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
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
end
Related
I have an error when trying to run heroku run rake db:migrate. What is interesting about this error is that I do not get it locally, nor do I get it on our production server (also on Heroku). Only the staging server is experiencing this issue.
It seems like the timestamps in a particular migration is throwing the error:
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
wrong number of arguments (given 1, expected 0)
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:351:in `timestamps'
/app/db/migrate/20170609154646_create_orders.rb:9:in `block in change'
...
Caused by:
ArgumentError: wrong number of arguments (given 1, expected 0)
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:351:in `timestamps'
/app/db/migrate/20170609154646_create_orders.rb:9:in `block in change'
Here is the migration file /app/db/migrate/20170609154646_create_orders.rb:
class CreateOrders < ActiveRecord::Migration[5.0]
def change
create_table :orders do |t|
t.string :source, null: false
t.integer :source_order_id
t.integer :customer_id, null: false
t.string :type
t.boolean :fulfilled, default: false
t.timestamps :fullfilled_date
t.boolean :arrived, default: false
t.timestamps :arrived_date
t.timestamps :due_date
t.boolean :late, default: false
t.text :requester_notes
t.text :provider_notes
t.float :subtotal, null: false
t.float :total, null: false
t.float :discount
t.references :provider, references: :tailors, index: true
t.references :requester, references: :retailers, index: true
t.timestamps
end
end
end
And the full stack trace:
λ ~: heroku run rake db:migrate -a [app-name] --trace
Running rake db:migrate --trace on ⬢ [app-name]... up, run.2263 (Free)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
D, [2018-01-29T18:44:23.091296 #4] DEBUG -- : (21.4ms) SELECT pg_try_advisory_lock(2914900371259544535)
D, [2018-01-29T18:44:23.203445 #4] DEBUG -- : (16.6ms) SELECT "schema_migrations"."version" FROM "schema_migrations" ORDER BY "schema_migrations"."version" ASC
I, [2018-01-29T18:44:23.207416 #4] INFO -- : Migrating to CreateOrders (20170609154646)
D, [2018-01-29T18:44:23.230850 #4] DEBUG -- : (19.2ms) BEGIN
== 20170609154646 CreateOrders: migrating =====================================
-- adapter_name()
-> 0.0000s
-- adapter_name()
-> 0.0000s
-- create_table(:orders, {:id=>:integer})
D, [2018-01-29T18:44:23.246188 #4] DEBUG -- : (9.3ms) ROLLBACK
D, [2018-01-29T18:44:23.256813 #4] DEBUG -- : (9.8ms) SELECT pg_advisory_unlock(2914900371259544535)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
wrong number of arguments (given 1, expected 0)
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:351:in `timestamps'
/app/db/migrate/20170609154646_create_orders.rb:9:in `block in change'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration/compatibility.rb:49:in `block in create_table'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:282:in `create_table'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:849:in `block in method_missing'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:818:in `block in say_with_time'
/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/benchmark.rb:293:in `measure'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:818:in `say_with_time'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:838:in `method_missing'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration/compatibility.rb:45:in `create_table'
/app/db/migrate/20170609154646_create_orders.rb:3:in `change'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:792:in `exec_migration'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:776:in `block (2 levels) in migrate'
/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/benchmark.rb:293:in `measure'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:775:in `block in migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:408:in `with_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:774:in `migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:953:in `migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1230:in `block in execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1298:in `block in ddl_transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:210:in `transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1298:in `ddl_transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1229:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1201:in `block in migrate_without_lock'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1200:in `each'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1200:in `migrate_without_lock'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1148:in `block in migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1317:in `with_advisory_lock'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1148:in `migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1007:in `up'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:985:in `migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:171:in `migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/task.rb:251:in `block in execute'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/task.rb:251:in `each'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/task.rb:251:in `execute'
/app/vendor/bundle/ruby/2.3.0/gems/airbrake-7.1.0/lib/airbrake/rake.rb:19:in `execute'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/task.rb:195:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/task.rb:188:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/task.rb:181:in `invoke'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:160:in `invoke_task'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:116:in `each'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:116:in `block in top_level'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:125:in `run_with_threads'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:110:in `top_level'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:83:in `block in run'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:186:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:80:in `run'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/app/vendor/bundle/ruby/2.3.0/bin/rake:22:in `load'
/app/vendor/bundle/ruby/2.3.0/bin/rake:22:in `<top (required)>'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `load'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:27:in `run'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli.rb:360:in `exec'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor.rb:369:in `dispatch'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli.rb:20:in `dispatch'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli.rb:10:in `start'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/exe/bundle:30:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/exe/bundle:22:in `<top (required)>'
/app/bin/bundle:3:in `load'
/app/bin/bundle:3:in `<main>'
Caused by:
ArgumentError: wrong number of arguments (given 1, expected 0)
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/schema_definitions.rb:351:in `timestamps'
/app/db/migrate/20170609154646_create_orders.rb:9:in `block in change'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration/compatibility.rb:49:in `block in create_table'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:282:in `create_table'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:849:in `block in method_missing'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:818:in `block in say_with_time'
/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/benchmark.rb:293:in `measure'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:818:in `say_with_time'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:838:in `method_missing'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration/compatibility.rb:45:in `create_table'
/app/db/migrate/20170609154646_create_orders.rb:3:in `change'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:792:in `exec_migration'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:776:in `block (2 levels) in migrate'
/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/benchmark.rb:293:in `measure'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:775:in `block in migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:408:in `with_connection'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:774:in `migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:953:in `migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1230:in `block in execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1298:in `block in ddl_transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `block in transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:194:in `block in within_new_transaction'
/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/transaction.rb:191:in `within_new_transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/connection_adapters/abstract/database_statements.rb:235:in `transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/transactions.rb:210:in `transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1298:in `ddl_transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1229:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1201:in `block in migrate_without_lock'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1200:in `each'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1200:in `migrate_without_lock'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1148:in `block in migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1317:in `with_advisory_lock'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1148:in `migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:1007:in `up'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/migration.rb:985:in `migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/tasks/database_tasks.rb:171:in `migrate'
/app/vendor/bundle/ruby/2.3.0/gems/activerecord-5.1.4/lib/active_record/railties/databases.rake:58:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/task.rb:251:in `block in execute'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/task.rb:251:in `each'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/task.rb:251:in `execute'
/app/vendor/bundle/ruby/2.3.0/gems/airbrake-7.1.0/lib/airbrake/rake.rb:19:in `execute'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/task.rb:195:in `block in invoke_with_call_chain'
/app/vendor/ruby-2.3.4/lib/ruby/2.3.0/monitor.rb:214:in `mon_synchronize'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/task.rb:188:in `invoke_with_call_chain'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/task.rb:181:in `invoke'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:160:in `invoke_task'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:116:in `each'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:116:in `block in top_level'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:125:in `run_with_threads'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:110:in `top_level'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:83:in `block in run'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:186:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/lib/rake/application.rb:80:in `run'
/app/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
/app/vendor/bundle/ruby/2.3.0/bin/rake:22:in `load'
/app/vendor/bundle/ruby/2.3.0/bin/rake:22:in `<top (required)>'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `load'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:74:in `kernel_load'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli/exec.rb:27:in `run'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli.rb:360:in `exec'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor.rb:369:in `dispatch'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli.rb:20:in `dispatch'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/vendor/thor/lib/thor/base.rb:444:in `start'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/cli.rb:10:in `start'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/exe/bundle:30:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/lib/bundler/friendly_errors.rb:121:in `with_friendly_errors'
/app/vendor/bundle/ruby/2.3.0/gems/bundler-1.15.2/exe/bundle:22:in `<top (required)>'
/app/bin/bundle:3:in `load'
/app/bin/bundle:3:in `<main>'
Tasks: TOP => db:migrate
If anyone has any ideas what could be causing this, it would be greatly appreciated!
You should use datetime instead of timestamp for columns 'fullfilled_date', 'arrived_date' and 'due_date' as timestamp will not take any arguments
def change
create_table :orders do |t|
t.string :source, null: false
t.integer :source_order_id
t.integer :customer_id, null: false
t.string :type
t.boolean :fulfilled, default: false
t.datetime :fullfilled_date
t.boolean :arrived, default: false
t.datetime :arrived_date
t.datetime :due_date
t.boolean :late, default: false
t.text :requester_notes
t.text :provider_notes
t.float :subtotal, null: false
t.float :total, null: false
t.float :discount
t.references :provider, references: :tailors, index: true
t.references :requester, references: :retailers, index: true
t.timestamps
end
end
How do I solve this?
I have no issues locally as I run rake db:migrate successfully. But on Heroku, I get this.
and when I run heroku run rake db:migrate --trace
$ heroku run rake db:migrate --trace
WARNING: Toolbelt is currently updating
Running rake db:migrate --trace on project-michelangelo... up, run.3483
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
Migrating to AddAttachmentAvatarToUsers (20160209034141)
== 20160209034141 AddAttachmentAvatarToUsers: migrating =======================
-- change_table(:users)
PG::DuplicateColumn: ERROR: column "avatar_file_name" of relation "users" alrea
dy exists
: ALTER TABLE "users" ADD COLUMN "avatar_file_name" character varying(255)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::DuplicateColumn: ERROR: column "avatar_file_name" of relation "users" alrea
dy exists
: ALTER TABLE "users" ADD COLUMN "avatar_file_name" character varying(255)/app/v
endor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connection_ad
apters/postgresql/database_statements.rb:128:in `async_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `block in execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:378:in `block in log'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.14/lib/active_support/notif
ications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:372:in `log'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:127:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:375:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/schema_statements.rb:398:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_definitions.rb:361:in `column'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:60:in
`block (2 levels) in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`each_pair'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`block in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`each'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`attachment'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:4:in `block in
up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:349:in `change_table'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:656:in `block in method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `block in say_with_time'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `say_with_time'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:648:in `method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:413:in `method_missing'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:3:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:565:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:605:in `exec_migration'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:586:in `block (2 levels) in migrate'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:585:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:294:in `with_connection'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:584:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:759:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:998:in `block in execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `block in ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `block in transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/transac
tions.rb:208:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:997:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:959:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:814:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:792:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/railtie
s/databases.rake:34:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in
execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in
invoke_with_call_chain'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_w
ith_call_chain'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `i
nvoke_task'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock (2 levels) in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `e
ach'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `r
un_with_threads'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `t
op_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `bl
ock in run'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `s
tandard_exception_handling'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `ru
n'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.1.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.1.0/bin/rake:23:in `<main>'
ActiveRecord::StatementInvalid: PG::DuplicateColumn: ERROR: column "avatar_file
_name" of relation "users" already exists
: ALTER TABLE "users" ADD COLUMN "avatar_file_name" character varying(255)
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `async_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `block in execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:378:in `block in log'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.14/lib/active_support/notif
ications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:372:in `log'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:127:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:375:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/schema_statements.rb:398:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_definitions.rb:361:in `column'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:60:in
`block (2 levels) in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`each_pair'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`block in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`each'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`attachment'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:4:in `block in
up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:349:in `change_table'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:656:in `block in method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `block in say_with_time'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `say_with_time'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:648:in `method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:413:in `method_missing'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:3:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:565:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:605:in `exec_migration'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:586:in `block (2 levels) in migrate'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:585:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:294:in `with_connection'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:584:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:759:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:998:in `block in execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `block in ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `block in transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/transac
tions.rb:208:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:997:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:959:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:814:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:792:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/railtie
s/databases.rake:34:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in
execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in
invoke_with_call_chain'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_w
ith_call_chain'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `i
nvoke_task'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock (2 levels) in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `e
ach'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `r
un_with_threads'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `t
op_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `bl
ock in run'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `s
tandard_exception_handling'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `ru
n'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.1.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.1.0/bin/rake:23:in `<main>'
PG::DuplicateColumn: ERROR: column "avatar_file_name" of relation "users" alrea
dy exists
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `async_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `block in execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:378:in `block in log'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.14/lib/active_support/notif
ications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:372:in `log'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:127:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:375:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/schema_statements.rb:398:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_definitions.rb:361:in `column'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:60:in
`block (2 levels) in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`each_pair'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`block in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`each'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`attachment'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:4:in `block in
up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:349:in `change_table'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:656:in `block in method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `block in say_with_time'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `say_with_time'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:648:in `method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:413:in `method_missing'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:3:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:565:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:605:in `exec_migration'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:586:in `block (2 levels) in migrate'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:585:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:294:in `with_connection'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:584:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:759:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:998:in `block in execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `block in ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `block in transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/transac
tions.rb:208:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:997:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:959:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:814:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:792:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/railtie
s/databases.rake:34:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in
execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in
invoke_with_call_chain'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_w
ith_call_chain'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `i
nvoke_task'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock (2 levels) in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `e
ach'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `r
un_with_threads'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `t
op_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `bl
ock in run'
this is my schema.rb with users table only
create_table "users", force: true do |t|
t.string "email", default: "", null: false
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", null: false
t.datetime "updated_at", null: false
t.string "first_name"
t.string "last_name"
t.string "avatar_file_name"
t.string "avatar_content_type"
t.integer "avatar_file_size"
t.datetime "avatar_updated_at"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
UPDATE:
db/migrate
class AddAttachmentAvatarToUsers < ActiveRecord::Migration
def self.up
change_table :users do |t|
t.attachment :avatar
end
end
def self.down
remove_attachment :users, :avatar
end
end
NEWBIE: I am trying to set up the membership part of my site. I ran the following commands:
git checkout development
git merge user_authentication
git checkout -b stripe_integration
bundle exec rails g migration CreatePlans
and received the this error:
ActiveRecord::PendingMigrationError: Migrations are pending. To
resolve this issue, run: bin/rake db:migrate RAILS_ENV=development
I've tried running it and other commands with no success. Below are links to other Stack Overflow answers to this issue that did not work for me and a full trace.
Link from Stack Overflow 1
Link from Stack Overflow 2
Full trace:
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)
Which email should I remove from the add_devise_to_user.rb file?
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
Looking into the AddDeviseToUsers migration error stack trace, you may notice that you have a duplicate email column. You already have an email column on the users table and that particular migration is trying to add another one.
I'd advise you to edit AddDeviseToUsers to remove the email column creation. If you're not familiar with Rails directory structure, you may find that file at db/migrate/xxxxxxxxxxx_add_devise_to_users.rb
I hope it helps.
I have a problem while running rake db:migrate to create a new table(migration file generated by rails g model).
class CreateReminderLogs < ActiveRecord::Migration
def change
create_table :reminder_logs do |t|
t.string :remindable_type
t.integer :remindable_id
t.integer :user_id
t.string :remindable_email
t.datetime :reminder_sent_at
t.timestamps
end
add_index :reminder_logs, :user_id
add_index :reminder_logs, :remindable_id
end
end
After adding --trace option to my command it shows up the stack as shown below. Seems like the error is related to foreign key but I didn't specify any foreign key attribute in this migration.
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
== 20151119105903 CreateReminderLogs: migrating ===============================
-- create_table(:reminder_logs)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
wrong number of arguments (4 for 1..2)/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/foreigner-1.6.1/lib/foreigner/connection_adapters/abstract/table_definition.rb:4:in `foreign_key'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/schema_plus-1.5.1/lib/schema_plus/active_record/connection_adapters/table_definition.rb:159:in `add_foreign_key'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/schema_plus-1.5.1/lib/schema_plus/active_record/column_options_handler.rb:24:in `schema_plus_handle_column_options'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/schema_plus-1.5.1/lib/schema_plus/active_record/connection_adapters/table_definition.rb:127:in `column_with_schema_plus'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/abstract/schema_definitions.rb:234:in `block (3 levels) in <class:TableDefinition>'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/abstract/schema_definitions.rb:234:in `each'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/abstract/schema_definitions.rb:234:in `block (2 levels) in <class:TableDefinition>'
/Users/nayiaw/Documents/workspace/my-resipi/db/migrate/20151119105903_create_reminder_logs.rb:5:in `block in change'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/foreigner-1.6.1/lib/foreigner/connection_adapters/abstract/schema_statements.rb:16:in `call'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/foreigner-1.6.1/lib/foreigner/connection_adapters/abstract/schema_statements.rb:16:in `block in create_table'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/schema_plus-1.5.1/lib/schema_plus/active_record/connection_adapters/schema_statements.rb:42:in `block in create_table_with_schema_plus'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/abstract/schema_statements.rb:198:in `create_table'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/schema_plus-1.5.1/lib/schema_plus/active_record/connection_adapters/schema_statements.rb:37:in `create_table_with_schema_plus'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/foreigner-1.6.1/lib/foreigner/connection_adapters/abstract/schema_statements.rb:14:in `create_table'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:460:in `create_table'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:656:in `block in method_missing'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:628:in `block in say_with_time'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:628:in `say_with_time'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:648:in `method_missing'
/Users/nayiaw/Documents/workspace/my-resipi/db/migrate/20151119105903_create_reminder_logs.rb:3:in `change'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:602:in `exec_migration'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:586:in `block (2 levels) in migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:585:in `block in migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:584:in `migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:759:in `migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:1046:in `ddl_transaction'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:959:in `block in migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:955:in `each'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:955:in `migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:814:in `up'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:792:in `migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/Users/nayiaw/.rbenv/versions/2.1.2/bin/rake:23:in `load'
/Users/nayiaw/.rbenv/versions/2.1.2/bin/rake:23:in `<main>'
ArgumentError: wrong number of arguments (4 for 1..2)
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/foreigner-1.6.1/lib/foreigner/connection_adapters/abstract/table_definition.rb:4:in `foreign_key'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/schema_plus-1.5.1/lib/schema_plus/active_record/connection_adapters/table_definition.rb:159:in `add_foreign_key'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/schema_plus-1.5.1/lib/schema_plus/active_record/column_options_handler.rb:24:in `schema_plus_handle_column_options'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/schema_plus-1.5.1/lib/schema_plus/active_record/connection_adapters/table_definition.rb:127:in `column_with_schema_plus'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/abstract/schema_definitions.rb:234:in `block (3 levels) in <class:TableDefinition>'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/abstract/schema_definitions.rb:234:in `each'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/abstract/schema_definitions.rb:234:in `block (2 levels) in <class:TableDefinition>'
/Users/nayiaw/Documents/workspace/my-resipi/db/migrate/20151119105903_create_reminder_logs.rb:5:in `block in change'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/foreigner-1.6.1/lib/foreigner/connection_adapters/abstract/schema_statements.rb:16:in `call'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/foreigner-1.6.1/lib/foreigner/connection_adapters/abstract/schema_statements.rb:16:in `block in create_table'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/schema_plus-1.5.1/lib/schema_plus/active_record/connection_adapters/schema_statements.rb:42:in `block in create_table_with_schema_plus'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/abstract/schema_statements.rb:198:in `create_table'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/schema_plus-1.5.1/lib/schema_plus/active_record/connection_adapters/schema_statements.rb:37:in `create_table_with_schema_plus'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/foreigner-1.6.1/lib/foreigner/connection_adapters/abstract/schema_statements.rb:14:in `create_table'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:460:in `create_table'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:656:in `block in method_missing'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:628:in `block in say_with_time'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:628:in `say_with_time'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:648:in `method_missing'
/Users/nayiaw/Documents/workspace/my-resipi/db/migrate/20151119105903_create_reminder_logs.rb:3:in `change'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:602:in `exec_migration'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:586:in `block (2 levels) in migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:585:in `block in migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:584:in `migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:759:in `migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:1046:in `ddl_transaction'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:959:in `block in migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:955:in `each'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:955:in `migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:814:in `up'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/migration.rb:792:in `migrate'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/activerecord-4.1.13/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/Users/nayiaw/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/Users/nayiaw/.rbenv/versions/2.1.2/bin/rake:23:in `load'
/Users/nayiaw/.rbenv/versions/2.1.2/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate
I thought this problem is similar to this SO question but judging from the stacktrace it seems different. I've tried update the arel gem to version >= 6.0.3 but it has compatibility error.
Bundler could not find compatible versions for gem "arel":
In Gemfile:
default_value_for (~> 3.0.0) ruby depends on
activerecord (< 5.0, >= 3.2.0) ruby depends on
arel (~> 5.0.0) ruby
arel (>= 6.0.3, ~> 6.0) ruby
The Rails version of this project is '4.1.13'.
Please help me as I couldn't find any solution online. Thanks in advance.
It would appear that the SchemaPlus gem is interfering with your index adding code. You could adjust your migration to look like:
class CreateReminderLogs < ActiveRecord::Migration
def change
create_table :reminder_logs do |t|
t.string :remindable_type
t.integer :remindable_id, index: true
t.integer :user_id, index: true
t.string :remindable_email
t.datetime :reminder_sent_at
t.timestamps
end
end
end
I am using my local environment on Mac OS X with Rails 4.
When trying to run my migration, it is not running.
I receive the following output:
*******-C02MGBVJFD57:myapp *************$ bundle exec rake db:migrate
Your Gemfile lists the gem faker (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem factory_girl_rails (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
== 20140815221246 AddPasswordDigestToUsers: migrating =========================
-- add_column(:users, :password_digest, :string)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: Duplicate column name 'password_digest': ALTER TABLE `users` ADD `password_digest` varchar(255)/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `query'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `block in execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activesupport-4.1.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/mysql2_adapter.rb:228:in `execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:649:in `block in method_missing'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:621:in `block in say_with_time'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:621:in `say_with_time'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:641:in `method_missing'
/Users/*************/workspace/myapp/db/migrate/20140815221246_add_password_digest_to_users.rb:3:in `change'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:595:in `exec_migration'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:578:in `block in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:577:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:752:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:1040:in `ddl_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:953:in `block in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:949:in `each'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:949:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:807:in `up'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:785:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
ActiveRecord::StatementInvalid: Mysql2::Error: Duplicate column name 'password_digest': ALTER TABLE `users` ADD `password_digest` varchar(255)
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `query'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `block in execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activesupport-4.1.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/mysql2_adapter.rb:228:in `execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:649:in `block in method_missing'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:621:in `block in say_with_time'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:621:in `say_with_time'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:641:in `method_missing'
/Users/*************/workspace/myapp/db/migrate/20140815221246_add_password_digest_to_users.rb:3:in `change'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:595:in `exec_migration'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:578:in `block in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:577:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:752:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:1040:in `ddl_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:953:in `block in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:949:in `each'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:949:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:807:in `up'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:785:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
Mysql2::Error: Duplicate column name 'password_digest'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `query'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `block in execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activesupport-4.1.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/mysql2_adapter.rb:228:in `execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:649:in `block in method_missing'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:621:in `block in say_with_time'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:621:in `say_with_time'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:641:in `method_missing'
/Users/*************/workspace/myapp/db/migrate/20140815221246_add_password_digest_to_users.rb:3:in `change'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:595:in `exec_migration'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:578:in `block in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:577:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:752:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:1040:in `ddl_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:953:in `block in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:949:in `each'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:949:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:807:in `up'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:785:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Any idea what is wrong?
EDIT:
The schema for the users table below:
create_table "users", force: true do |t|
t.string "name"
t.string "email"
t.datetime "created_at"
t.datetime "updated_at"
t.string "password_digest"
t.string "remember_digest"
end
Users Migration:
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.string :email
t.string :password_digest
t.timestamps
end
end
end
class AddPasswordDigestToUsers < ActiveRecord::Migration
def change
add_column :users, :password_digest, :string
end
end
class AddRememberDigestToUsers < ActiveRecord::Migration
def change
add_column :users, :remember_digest, :string
end
end
The issue is happening because in your CreateUsers migration, you are already creating a users table with the password_digest column as evidenced by this line:
t.string :password_digest
Then, in your AddPasswordDigestToUsers migration, you're trying to add a column with the same name to the users table:
add_column :users, :password_digest, :string
This is where the migration failed with the error Mysql2::Error: Duplicate column name 'password_digest'.
Are you sure you need the AddPasswordDigestToUsers file? It doesn't seem like it because you already added the column in the CreateUsers migration.
I think you can simply delete the AddPasswordDigestToUsers migration file and try re-running bundle exec rake db:migrate.