PG::UndefinedTable: ERROR: relation "<name>" does not exist - ruby-on-rails

I have looked through similar answers, but it didn't work for my question.
I use Windows 10 + Ubuntu 18.04 and try to change the database of a Rails project from SQLite3 to PostgreSQL. After I modified the Gemfile, executed the bundle and completed the modification of database.yml, I proceeded to $rails db:create.
Finally, I tried to do $rails db:migrate, and the following error occurred:
== 20211211075029 CreateSpaceUsers: migrating =================================
-- create_table(:space_users)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedTable: ERROR: relation "Spaces" does not exist
/home/keaton/.rvm/gems/ruby-2.6.6/gems/rack-mini-profiler-2.3.3/lib/patches/db/pg.rb:110:in `exec'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/rack-mini-profiler-2.3.3/lib/patches/db/pg.rb:110:in `async_exec'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block (2 levels) in execute'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `block in execute'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract_adapter.rb:696:in `block (2 levels) in log'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract_adapter.rb:695:in `block in log'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract_adapter.rb:687:in `log'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:45:in `execute'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:322:in `create_table'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:929:in `block in method_missing'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:897:in `block in say_with_time'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:897:in `say_with_time'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:918:in `method_missing'
/mnt/c/projects/Ksnew/db/migrate/20211211075029_create_space_users.rb:3:in `change'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:867:in `exec_migration'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:850:in `block in migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:849:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1037:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1380:in `block in ddl_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/transactions.rb:209:in `transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1380:in `ddl_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1302:in `each'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1251:in `block in migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1251:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1086:in `up'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1061:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `each'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/home/keaton/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:24:in `eval'
/home/keaton/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:24:in `<main>'
Caused by:
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "Spaces" does not exist
/home/keaton/.rvm/gems/ruby-2.6.6/gems/rack-mini-profiler-2.3.3/lib/patches/db/pg.rb:110:in `exec'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/rack-mini-profiler-2.3.3/lib/patches/db/pg.rb:110:in `async_exec'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block (2 levels) in execute'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `block in execute'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract_adapter.rb:696:in `block (2 levels) in log'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract_adapter.rb:695:in `block in log'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract_adapter.rb:687:in `log'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:45:in `execute'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:322:in `create_table'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:929:in `block in method_missing'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:897:in `block in say_with_time'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:897:in `say_with_time'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:918:in `method_missing'
/mnt/c/projects/Ksnew/db/migrate/20211211075029_create_space_users.rb:3:in `change'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:867:in `exec_migration'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:850:in `block in migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:849:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1037:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1380:in `block in ddl_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/transactions.rb:209:in `transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1380:in `ddl_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1302:in `each'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1251:in `block in migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1251:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1086:in `up'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1061:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `each'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/home/keaton/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:24:in `eval'
/home/keaton/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:24:in `<main>'
Caused by:
PG::UndefinedTable: ERROR: relation "Spaces" does not exist
/home/keaton/.rvm/gems/ruby-2.6.6/gems/rack-mini-profiler-2.3.3/lib/patches/db/pg.rb:110:in `exec'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/rack-mini-profiler-2.3.3/lib/patches/db/pg.rb:110:in `async_exec'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:47:in `block (2 levels) in execute'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:46:in `block in execute'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract_adapter.rb:696:in `block (2 levels) in log'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract_adapter.rb:695:in `block in log'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract_adapter.rb:687:in `log'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/postgresql/database_statements.rb:45:in `execute'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/schema_statements.rb:322:in `create_table'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:929:in `block in method_missing'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:897:in `block in say_with_time'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:897:in `say_with_time'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:918:in `method_missing'
/mnt/c/projects/Ksnew/db/migrate/20211211075029_create_space_users.rb:3:in `change'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:867:in `exec_migration'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:851:in `block (2 levels) in migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:850:in `block in migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:849:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1037:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1329:in `block in execute_migration_in_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1380:in `block in ddl_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/transaction.rb:319:in `block in within_new_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activesupport-6.1.4.1/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/transaction.rb:317:in `within_new_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/transactions.rb:209:in `transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1380:in `ddl_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1328:in `execute_migration_in_transaction'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1302:in `each'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1302:in `migrate_without_lock'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1251:in `block in migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1401:in `block in with_advisory_lock'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1416:in `block in with_advisory_lock_connection'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in `with_connection'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1416:in `with_advisory_lock_connection'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1397:in `with_advisory_lock'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1251:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1086:in `up'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/migration.rb:1061:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/tasks/database_tasks.rb:237:in `migrate'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:92:in `block (3 levels) in <main>'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `each'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/activerecord-6.1.4.1/lib/active_record/railties/databases.rake:90:in `block (2 levels) in <main>'
/home/keaton/.rvm/gems/ruby-2.6.6/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/home/keaton/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:24:in `eval'
/home/keaton/.rvm/gems/ruby-2.6.6/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
This is my database.yml
default: &default
adapter: postgresql
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
timeout: 5000
development:
<<: *default
database: Ksnew_with_pg_development
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
<<: *default
database: Ksnew_with_pg_test
production:
<<: *default
database: Ksnew_with_pg_production
I also tried to execute the $psql command, but the following error message appeared
psql: FATAL: database "keaton" does not exist
I really don't know what to do, please teach me, thank you

Related

Rails migration error: Wrong number of arguments

I just cloned a repository, so I am trying to setup locally, I get this strange error whenever I run rails db:migrate, I have searched for a solution but none on here meets my need.
I have been particularly confused at this because it is my first time using rails 6.0 and I cannot tell if it is an issue with rails or something is wrong in the code, although following the trace the issue seems to be with the timestamps type but I do not know what to do
Error
DEPRECATION WARNING: Single arity template handlers are deprecated. Template handlers must
now accept two parameters, the view object and the source for the view object.
Change:
>> Coffee::Rails::TemplateHandler.call(template)
To:
>> Coffee::Rails::TemplateHandler.call(template, source)
(called from <main> at /home/noriodebrume/crowdfrica/config/application.rb:7)
** Invoke db:migrate (first_time)
** Invoke db:load_config (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:load_config
** Execute db:migrate
== 20160807112612 CreateProjects: migrating ===================================
-- create_table(:projects, {:id=>:integer})
rails aborted!
StandardError: An error has occurred, this and all later migrations canceled:
wrong number of arguments (given 1, expected 0)
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration/compatibility.rb:20:in `timestamps'
/home/noriodebrume/crowdfrica/db/migrate/20160807112612_create_projects.rb:8:in `block in change'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration/compatibility.rb:44:in `block in create_table'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/schema_statements.rb:309:in `create_table'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:882:in `block in method_missing'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:850:in `block in say_with_time'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/2.6.0/benchmark.rb:293:in `measure'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:850:in `say_with_time'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:871:in `method_missing'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration/compatibility.rb:44:in `create_table'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration/compatibility.rb:104:in `create_table'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration/compatibility.rb:142:in `create_table'
/home/noriodebrume/crowdfrica/db/migrate/20160807112612_create_projects.rb:3:in `change'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:820:in `exec_migration'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:804:in `block (2 levels) in migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/2.6.0/benchmark.rb:293:in `measure'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:803:in `block in migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `with_connection'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:802:in `migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:992:in `migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1300:in `block in execute_migration_in_transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1351:in `block in ddl_transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/database_statements.rb:277:in `block in transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/transaction.rb:272:in `block in within_new_transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/transaction.rb:270:in `within_new_transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/database_statements.rb:277:in `transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/transactions.rb:212:in `transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1351:in `ddl_transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1299:in `execute_migration_in_transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1271:in `block in migrate_without_lock'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1270:in `each'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1270:in `migrate_without_lock'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1218:in `block in migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1371:in `with_advisory_lock'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1218:in `migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1051:in `up'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1026:in `migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/tasks/database_tasks.rb:226:in `migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:83:in `block (3 levels) in <main>'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:81:in `each'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:81:in `block (2 levels) in <main>'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:160:in `invoke_task'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `each'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block in top_level'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:125:in `run_with_threads'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:110:in `top_level'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/command.rb:48:in `invoke'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands.rb:18:in `<main>'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `block in require'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:268:in `load_dependency'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `require'
bin/rails:4:in `<main>'
Caused by:
ArgumentError: wrong number of arguments (given 1, expected 0)
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration/compatibility.rb:20:in `timestamps'
/home/noriodebrume/crowdfrica/db/migrate/20160807112612_create_projects.rb:8:in `block in change'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration/compatibility.rb:44:in `block in create_table'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/schema_statements.rb:309:in `create_table'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:882:in `block in method_missing'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:850:in `block in say_with_time'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/2.6.0/benchmark.rb:293:in `measure'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:850:in `say_with_time'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:871:in `method_missing'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration/compatibility.rb:44:in `create_table'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration/compatibility.rb:104:in `create_table'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration/compatibility.rb:142:in `create_table'
/home/noriodebrume/crowdfrica/db/migrate/20160807112612_create_projects.rb:3:in `change'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:820:in `exec_migration'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:804:in `block (2 levels) in migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/2.6.0/benchmark.rb:293:in `measure'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:803:in `block in migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `with_connection'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:802:in `migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:992:in `migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1300:in `block in execute_migration_in_transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1351:in `block in ddl_transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/database_statements.rb:277:in `block in transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/transaction.rb:272:in `block in within_new_transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/transaction.rb:270:in `within_new_transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/database_statements.rb:277:in `transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/transactions.rb:212:in `transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1351:in `ddl_transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1299:in `execute_migration_in_transaction'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1271:in `block in migrate_without_lock'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1270:in `each'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1270:in `migrate_without_lock'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1218:in `block in migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1371:in `with_advisory_lock'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1218:in `migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1051:in `up'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1026:in `migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/tasks/database_tasks.rb:226:in `migrate'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:83:in `block (3 levels) in <main>'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:81:in `each'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:81:in `block (2 levels) in <main>'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `block in execute'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `each'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:273:in `execute'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:214:in `block in invoke_with_call_chain'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/2.6.0/monitor.rb:230:in `mon_synchronize'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:194:in `invoke_with_call_chain'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/task.rb:183:in `invoke'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:160:in `invoke_task'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `each'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:116:in `block in top_level'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:125:in `run_with_threads'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:110:in `top_level'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands/rake/rake_command.rb:23:in `block in perform'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.2/lib/rake/application.rb:186:in `standard_exception_handling'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands/rake/rake_command.rb:20:in `perform'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/command.rb:48:in `invoke'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/railties-6.0.0.rc1/lib/rails/commands.rb:18:in `<main>'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `block in require'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:268:in `load_dependency'
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies.rb:302:in `require'
bin/rails:4:in `<main>'
Tasks: TOP => db:migrate
Here is the exact migration it points to:
class CreateProjects < ActiveRecord::Migration[5.0]
def change
create_table :projects do |t|
t.string :procect_name, null: false
t.numeric :project_goal
t.text :prgoject_headline
t.text :prgoject_description
t.timestamps :expires_at
t.timestamps
end
end
end
I want to add that ruby 2.6.3 is used for this project and this warning shows up whenever I run a migration:
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sprockets-3.6.3/lib/sprockets/digest_utils.rb:47: warning: constant ::Fixnum is deprecated
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sprockets-3.6.3/lib/sprockets/digest_utils.rb:51: warning: constant ::Bignum is deprecated
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sprockets-3.6.3/lib/sprockets/processor_utils.rb:110: warning: constant ::Fixnum is deprecated
/home/noriodebrume/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/sprockets-3.6.3/lib/sprockets/processor_utils.rb:111: warning: constant ::Bignum is deprecated
t.timestamps doesn't accept timestamp name, just hash/keyword arguments:
timestamps(options = {})
Adds timestamps (created_at and updated_at) columns to the table.
t.timestamps(null: false)
Docs
If you want to add expires_at, you need to add it using a correct date type (e.g. datetime:
class CreateProjects < ActiveRecord::Migration[5.0]
def change
create_table :projects do |t|
# ...
t.datetime :expires_at
end
end
end

PG::DuplicateColumn: ERROR: column "encrypted_password" of relation "users" already exists

So I've ran into a problem with running rails db:migrate which gives this error:
== 20190301194540 AddDeviseToUsers: migrating =================================
-- change_table(:users)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::DuplicateColumn: ERROR: column "encrypted_password" of relation "users" already exists
: ALTER TABLE "users" ADD "encrypted_password" character varying DEFAULT '' NOT NULL
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:75:in `async_exec'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:75:in `block (2 levels) in execute'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activesupport-5.2.2/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:74:in `block in execute'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:579:in `block (2 levels) in log'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:578:in `block in log'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activesupport-5.2.2/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:569:in `log'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:73:in `execute'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:581:in `add_column'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/schema_statements.rb:420:in `add_column'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb:527:in `column'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb:232:in `block in string'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb:232:in `each'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb:232:in `string'
/Users/programming/Desktop/fitnesshabbits/db/migrate/20190301194540_add_devise_to_users.rb:8:in `block in up'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:471:in `change_table'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:871:in `block in method_missing'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:840:in `block in say_with_time'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:840:in `say_with_time'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:860:in `method_missing'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:604:in `method_missing'
/Users/programming/Desktop/fitnesshabbits/db/migrate/20190301194540_add_devise_to_users.rb:5:in `up'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:777:in `up'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:817:in `exec_migration'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:798:in `block (2 levels) in migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:797:in `block in migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `with_connection'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:796:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:977:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1292:in `block in execute_migration_in_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1343:in `block in ddl_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:259:in `block in transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:259:in `transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/transactions.rb:212:in `transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1343:in `ddl_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1291:in `execute_migration_in_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1263:in `block in migrate_without_lock'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1262:in `each'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1262:in `migrate_without_lock'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1210:in `block in migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1363:in `with_advisory_lock'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1210:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1036:in `up'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1011:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <main>'
/Users/programming/.rvm/rubies/ruby-2.6.1/bin/bundle:23:in `load'
/Users/programming/.rvm/rubies/ruby-2.6.1/bin/bundle:23:in `<main>'
/Users/programming/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `eval'
/Users/programming/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `<main>'
Caused by:
ActiveRecord::StatementInvalid: PG::DuplicateColumn: ERROR: column "encrypted_password" of relation "users" already exists
: ALTER TABLE "users" ADD "encrypted_password" character varying DEFAULT '' NOT NULL
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:75:in `async_exec'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:75:in `block (2 levels) in execute'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activesupport-5.2.2/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activesupport-5.2.2/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:74:in `block in execute'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:579:in `block (2 levels) in log'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:578:in `block in log'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activesupport-5.2.2/lib/active_support/notifications/instrumenter.rb:23:in `instrument'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:569:in `log'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:73:in `execute'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:581:in `add_column'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/postgresql/schema_statements.rb:420:in `add_column'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb:527:in `column'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb:232:in `block in string'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb:232:in `each'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_definitions.rb:232:in `string'
/Users/programming/Desktop/fitnesshabbits/db/migrate/20190301194540_add_devise_to_users.rb:8:in `block in up'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:471:in `change_table'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:871:in `block in method_missing'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:840:in `block in say_with_time'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:840:in `say_with_time'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:860:in `method_missing'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:604:in `method_missing'
/Users/programming/Desktop/fitnesshabbits/db/migrate/20190301194540_add_devise_to_users.rb:5:in `up'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:777:in `up'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:817:in `exec_migration'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:798:in `block (2 levels) in migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:797:in `block in migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `with_connection'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:796:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:977:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1292:in `block in execute_migration_in_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1343:in `block in ddl_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:259:in `block in transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:259:in `transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/transactions.rb:212:in `transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1343:in `ddl_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1291:in `execute_migration_in_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1263:in `block in migrate_without_lock'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1262:in `each'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1262:in `migrate_without_lock'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1210:in `block in migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1363:in `with_advisory_lock'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1210:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1036:in `up'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1011:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <main>'
/Users/programming/.rvm/rubies/ruby-2.6.1/bin/bundle:23:in `load'
/Users/programming/.rvm/rubies/ruby-2.6.1/bin/bundle:23:in `<main>'
/Users/programming/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `eval'
/Users/programming/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `<main>'
/Users/programming/Desktop/fitnesshabbits/db/migrate/20190301194540_add_devise_to_users.rb:8:in `block in up'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:471:in `change_table'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:871:in `block in method_missing'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:840:in `block in say_with_time'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:840:in `say_with_time'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:860:in `method_missing'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:604:in `method_missing'
/Users/programming/Desktop/fitnesshabbits/db/migrate/20190301194540_add_devise_to_users.rb:5:in `up'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:777:in `up'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:817:in `exec_migration'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:798:in `block (2 levels) in migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:797:in `block in migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `with_connection'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:796:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:977:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1292:in `block in execute_migration_in_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1343:in `block in ddl_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:259:in `block in transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:239:in `block in within_new_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:236:in `within_new_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:259:in `transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/transactions.rb:212:in `transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1343:in `ddl_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1291:in `execute_migration_in_transaction'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1263:in `block in migrate_without_lock'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1262:in `each'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1262:in `migrate_without_lock'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1210:in `block in migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1363:in `with_advisory_lock'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1210:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1036:in `up'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/migration.rb:1011:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/tasks/database_tasks.rb:172:in `migrate'
/Users/programming/.rvm/gems/ruby-2.6.1/gems/activerecord-5.2.2/lib/active_record/railties/databases.rake:60:in `block (2 levels) in <main>'
/Users/programming/.rvm/rubies/ruby-2.6.1/bin/bundle:23:in `load'
/Users/programming/.rvm/rubies/ruby-2.6.1/bin/bundle:23:in `<main>'
/Users/programming/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `eval'
/Users/programming/.rvm/gems/ruby-2.6.1/bin/ruby_executable_hooks:24:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
This problem occurs even if I drop the database, comment out specific fields like, for example, encrypted_password in migration file. I've also tried to reset migration, set it to development mode. I'm using Devise and trying to run this migration file. If anyone got any ideas of why or how this happens I'd appreciate some ideas to fix this issue.
Could this happen because of an error in a certain file?
Migration status:
database: fitnesshabbits_development
Status Migration ID Migration Name
--------------------------------------------------
up 20190227233216 Devise create users
down 20190301194540 Add devise to users
I think that you have add the same field in your two migrations.
I think that you have add encrypted_password in you AddDeviseToUsers migration.
Lock that in your migrations don't have field that are repeat.

Remove duplicate columns in rails migration

I am had Paperclip gem in my app then I removed it and I wanna add it back again. However, I am getting this error when I try to rake db:migrate:
ActiveRecord::SchemaMigration Load (0.4ms) SELECT "schema_migrations".* FROM "schema_migrations"
Migrating to AddAttachmentImageToPosts (20170115210207)
(0.3ms) BEGIN
== 20170115210207 AddAttachmentImageToPosts: migrating ========================
-- change_table(:posts)
(0.9ms) ALTER TABLE "posts" ADD "image_file_name" character varying
(0.2ms) ROLLBACK
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::DuplicateColumn: ERROR: column "image_file_name" of relation "posts" already exists
: ALTER TABLE "posts" ADD "image_file_name" character varying
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:393:in `add_column'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:423:in `add_column'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_definitions.rb:443:in `column'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:54:in `block (2 levels) in attachment'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:52:in `each_pair'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:52:in `block in attachment'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:51:in `each'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:51:in `attachment'
/home/ubuntu/workspace/db/migrate/20170115210207_add_attachment_image_to_posts.rb:4:in `block in up'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:363:in `change_table'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:in `block in method_missing'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `block in say_with_time'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `say_with_time'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in `method_missing'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:416:in `method_missing'
/home/ubuntu/workspace/db/migrate/20170115210207_add_attachment_image_to_posts.rb:3:in `up'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:571:in `up'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:611:in `exec_migration'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in `block in migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in `transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `ddl_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in `block in migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `each'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
ActiveRecord::StatementInvalid: PG::DuplicateColumn: ERROR: column "image_file_name" of relation "posts" already exists
: ALTER TABLE "posts" ADD "image_file_name" character varying
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:393:in `add_column'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:423:in `add_column'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_definitions.rb:443:in `column'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:54:in `block (2 levels) in attachment'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:52:in `each_pair'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:52:in `block in attachment'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:51:in `each'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:51:in `attachment'
/home/ubuntu/workspace/db/migrate/20170115210207_add_attachment_image_to_posts.rb:4:in `block in up'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:363:in `change_table'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:in `block in method_missing'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `block in say_with_time'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `say_with_time'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in `method_missing'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:416:in `method_missing'
/home/ubuntu/workspace/db/migrate/20170115210207_add_attachment_image_to_posts.rb:3:in `up'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:571:in `up'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:611:in `exec_migration'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in `block in migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in `transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `ddl_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in `block in migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `each'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
PG::DuplicateColumn: ERROR: column "image_file_name" of relation "posts" already exists
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'
/usr/local/rvm/gems/ruby-2.3.0/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:393:in `add_column'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:423:in `add_column'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_definitions.rb:443:in `column'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:54:in `block (2 levels) in attachment'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:52:in `each_pair'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:52:in `block in attachment'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:51:in `each'
/usr/local/rvm/gems/ruby-2.3.0/gems/paperclip-5.1.0/lib/paperclip/schema.rb:51:in `attachment'
/home/ubuntu/workspace/db/migrate/20170115210207_add_attachment_image_to_posts.rb:4:in `block in up'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/schema_statements.rb:363:in `change_table'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:in `block in method_missing'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `block in say_with_time'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `say_with_time'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in `method_missing'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:416:in `method_missing'
/home/ubuntu/workspace/db/migrate/20170115210207_add_attachment_image_to_posts.rb:3:in `up'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:571:in `up'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:611:in `exec_migration'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in `block in migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in `transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `ddl_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in `block in migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `each'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/gems/rake-12.0.0/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
/usr/local/rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
When I ran rails c this is what I got:
2.3.0 :001 > Post.column_names
=> ["id", "title", "link", "description", "created_at", "updated_at", "user_id", "image_file_name", "image_content_type", "image_file_size", "image_updated_at", "cached_votes_total", "cached_votes_score", "cached_votes_up", "cached_votes_down", "cached_weighted_score", "cached_weighted_total", "cached_weighted_average", "image"]
I know that there is a way to remove the "image_file_name" duplication but I am not really aware of how to do so to my app. I did find some posts that are similar to my problem but nothing really solved it!
Because you deleted the migration for creating the column, and if you create a migration to delete it, it will cause error in other environment(production), as there is no column to be deleted at first place.
Assuming you haven't deploy the migration to production.
You can just drop the column directly in database console.
run rails dbconsole
and
ALTER TABLE posts DROP COLUMN image_file_name;
First of all, you should never just remove a migration. If you want to remove a field you should create a new migration for it.
You have 2 options now, or you can rake db:migration:reset that will recreate your entire database OR you can comment the content on this last migration, run rake db:migrate and after that you can uncomment it.

How to write a migration changing id to uuid

class ChangeIdtoUuiDforcarts < ActiveRecord::Migration
def change
rename_column :carts, :id, :uuid
change_column :carts, :uuid, 'using uuid::uuid'
end
end
I have tried the above migration, but it gives the following syntax error
-- rename_column(:carts, :id, :uuid)
-> 0.0032s
-- change_column(:carts, :uuid, "using uuid::uuid")
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::SyntaxError: ERROR: syntax error at or near "using"
LINE 1: ALTER TABLE "carts" ALTER COLUMN "uuid" TYPE using uuid::uui...
^
: ALTER TABLE "carts" ALTER COLUMN "uuid" TYPE using uuid::uuid
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/rack-mini-profiler-0.10.1/lib/patches/db/pg.rb:90:in `exec'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/rack-mini-profiler-0.10.1/lib/patches/db/pg.rb:90:in `async_exec'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activesupport-
4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:437:in `change_column'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:in `block in method_missing'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `block in say_with_time'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `say_with_time'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in `method_missing'
/home/gvpmahesh/code/shij/core/db/migrate/20160812081429_change_idto_uui_dforcarts.rb:4:in `change'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:608:in `exec_migration'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in `block in migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in `transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `ddl_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in `block in migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `each'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
ActiveRecord::StatementInvalid: PG::SyntaxError: ERROR: syntax error at or near "using"
LINE 1: ALTER TABLE "carts" ALTER COLUMN "uuid" TYPE using uuid::uui...
^
: ALTER TABLE "carts" ALTER COLUMN "uuid" TYPE using uuid::uuid
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/rack-mini-profiler-0.10.1/lib/patches/db/pg.rb:90:in `exec'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/rack-mini-profiler-0.10.1/lib/patches/db/pg.rb:90:in `async_exec'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:437:in `change_column'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:in `block in method_missing'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `block in say_with_time'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `say_with_time'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in `method_missing'
/home/gvpmahesh/code/shij/core/db/migrate/20160812081429_change_idto_uui_dforcarts.rb:4:in `change'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:608:in `exec_migration'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in `block in migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in `transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `ddl_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in `block in migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `each'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
PG::SyntaxError: ERROR: syntax error at or near "using"
LINE 1: ALTER TABLE "carts" ALTER COLUMN "uuid" TYPE using uuid::uui...
^
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/rack-mini-profiler-0.10.1/lib/patches/db/pg.rb:90:in `exec'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/rack-mini-profiler-0.10.1/lib/patches/db/pg.rb:90:in `async_exec'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:472:in `block in log'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activesupport-4.2.5/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract_adapter.rb:466:in `log'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/postgresql/schema_statements.rb:437:in `change_column'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:665:in `block in method_missing'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `block in say_with_time'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:634:in `say_with_time'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:654:in `method_missing'
/home/gvpmahesh/code/shij/core/db/migrate/20160812081429_change_idto_uui_dforcarts.rb:4:in `change'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:608:in `exec_migration'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:591:in `block in migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:590:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:768:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:998:in `block in execute_migration_in_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `block in ddl_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/transactions.rb:220:in `transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:1044:in `ddl_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:997:in `execute_migration_in_transaction'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:959:in `block in migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `each'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:955:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:823:in `up'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/migration.rb:801:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/activerecord-4.2.5/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/gems/rake-11.2.2/exe/rake:27:in `<top (required)>'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `eval'
/home/gvpmahesh/.rvm/gems/ruby-2.2.3/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
I have already enabled the uuid in another migration, and I don't want to drop the db So I can write id: :uuid in create table statement itself

Why am I being asked to RUN 'rake db:migrate RAILS_ENV=test'?

I've been following the tutorial "Multitenancy with Rails" by Ryan Bigg https://leanpub.com/multi-tenancy-rails.
Though I have run rake db:migrate I keep getting an error Migrations are pending. To resolve this issue run bin/rake db:migrate RAILS_ENV=test
If I do that I get another set of errors.
Since I don't have enough reputation, I can't post the images here.
If anyone has seen the book, I'm getting the error after adding the add_owner_id_to_accounts migration.
Any help would be really appreciated. Thanks!
This is the error I am getting:
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:392:in `check_pending!': (ActiveRecord::PendingMigrationError)
Migrations are pending. To resolve this issue, run:
bin/rake db:migrate RAILS_ENV=test
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:405:in `load_schema_if_pending!'
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:411:in `block in maintain_test_schema!'
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:639:in `suppress_messages'
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:416:in `method_missing'
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:411:in `maintain_test_schema!'
from /home/nikhil/workspace2/subscribem/spec/rails_helper.rb:29:in `<top (required)>'
from /home/nikhil/workspace2/subscribem/spec/features/accounts/sign_up_spec.rb:1:in `require'
from /home/nikhil/workspace2/subscribem/spec/features/accounts/sign_up_spec.rb:1:in `<top (required)>'
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1327:in `load'
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1327:in `block in load_spec_files'
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1325:in `each'
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.1/lib/rspec/core/configuration.rb:1325:in `load_spec_files'
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:102:in `setup'
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:88:in `run'
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:73:in `run'
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.1/lib/rspec/core/runner.rb:41:in `invoke'
from /home/nikhil/.rvm/gems/ruby-2.2.2/gems/rspec-core-3.3.1/exe/rspec:4:in `<top (required)>'
from /home/nikhil/.rvm/gems/ruby-2.2.2/bin/rspec:23:in `load'
from /home/nikhil/.rvm/gems/ruby-2.2.2/bin/rspec:23:in `<main>'
from /home/nikhil/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `eval'
from /home/nikhil/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in `<main>'
And this is what I'm getting if I run rake db:migrate RAILS_ENV=test(as the output asks me to)
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/tasks/statistics.rake:4: warning: already initialized constant STATS_DIRECTORIES
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/railties-4.2.3/lib/rails/tasks/statistics.rake:4: warning: previous definition of STATS_DIRECTORIES was here
== 20150627112900 CreateSubscribemAccounts: migrating =========================
-- create_table(:subscribem_accounts)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: table "subscribem_accounts" already exists: CREATE TABLE "subscribem_accounts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL) /home/nikhil/.rvm/gems/ruby-2.2.2/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/sqlite3_adapter.rb:329:in `block in execute'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/sqlite3_adapter.rb:329:in `execute'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:208:in `create_table'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:661:in `block in method_missing'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:631:in `block in say_with_time'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:631:in `say_with_time'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:651:in `method_missing'
/home/nikhil/workspace2/subscribem/db/migrate/20150627112900_create_subscribem_accounts.rb:3:in `change'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:605:in `exec_migration'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:589:in `block (2 levels) in migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:588:in `block in migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:587:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:764:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:994:in `block in execute_migration_in_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:1040:in `block in ddl_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/transactions.rb:220:in `transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:1040:in `ddl_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:993:in `execute_migration_in_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:955:in `block in migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:951:in `each'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:951:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:819:in `up'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:797:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
ActiveRecord::StatementInvalid: SQLite3::SQLException: table "subscribem_accounts" already exists: CREATE TABLE "subscribem_accounts" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar, "created_at" datetime NOT NULL, "updated_at" datetime NOT NULL)
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/sqlite3_adapter.rb:329:in `block in execute'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/sqlite3_adapter.rb:329:in `execute'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:208:in `create_table'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:661:in `block in method_missing'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:631:in `block in say_with_time'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:631:in `say_with_time'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:651:in `method_missing'
/home/nikhil/workspace2/subscribem/db/migrate/20150627112900_create_subscribem_accounts.rb:3:in `change'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:605:in `exec_migration'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:589:in `block (2 levels) in migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:588:in `block in migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:587:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:764:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:994:in `block in execute_migration_in_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:1040:in `block in ddl_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/transactions.rb:220:in `transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:1040:in `ddl_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:993:in `execute_migration_in_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:955:in `block in migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:951:in `each'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:951:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:819:in `up'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:797:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
SQLite3::SQLException: table "subscribem_accounts" already exists
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/sqlite3_adapter.rb:329:in `block in execute'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activesupport-4.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/sqlite3_adapter.rb:329:in `execute'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:208:in `create_table'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:661:in `block in method_missing'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:631:in `block in say_with_time'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:631:in `say_with_time'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:651:in `method_missing'
/home/nikhil/workspace2/subscribem/db/migrate/20150627112900_create_subscribem_accounts.rb:3:in `change'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:605:in `exec_migration'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:589:in `block (2 levels) in migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:588:in `block in migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:587:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:764:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:994:in `block in execute_migration_in_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:1040:in `block in ddl_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/transactions.rb:220:in `transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:1040:in `ddl_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:993:in `execute_migration_in_transaction'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:955:in `block in migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:951:in `each'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:951:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:819:in `up'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/migration.rb:797:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/home/nikhil/.rvm/gems/ruby-2.2.2/gems/activerecord-4.2.3/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate => app:db:migrate
(See full trace by running task with --trace)
In test_helper.rb -
ActiveRecord::Migration.maintain_test_schema!
This maintains your test database every time, whenever you run your tests.
It seem that the source of problem is here :
SQLite3::SQLException: table "subscribem_accounts" already exists
subscribem_accounts table seem already existing, and it's like you're trying to create it twice, so try to reset the database :
rake db:reset
this command will drop your actual database, and recreate it again for you

Resources