i wanted to implement an attachement field of video, images. and files(pdf.doc) field vis PAPERCLIP but after creating a migration "rails g paperclip projects image" and rails db:migrate it gives error
Running via Spring preloader in process 19493
== 20230116080101 AddAttachmentAvatarToProjects: migrating ====================
-- change_table(:projects)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
wrong number of arguments (given 3, expected 2)
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/schema_definitions.rb:603:in column' /usr/share/rvm/gems/ruby-3.0.0/gems/paperclip-6.1.0/lib/paperclip/schema.rb:54:in block (2 levels) in attachment'
/usr/share/rvm/gems/ruby-3.0.0/gems/paperclip-6.1.0/lib/paperclip/schema.rb:52:in each_pair' /usr/share/rvm/gems/ruby-3.0.0/gems/paperclip-6.1.0/lib/paperclip/schema.rb:52:in block in attachment'
/usr/share/rvm/gems/ruby-3.0.0/gems/paperclip-6.1.0/lib/paperclip/schema.rb:51:in each' /usr/share/rvm/gems/ruby-3.0.0/gems/paperclip-6.1.0/lib/paperclip/schema.rb:51:in attachment'
/var/www/html/rails/workshop_project3/db/migrate/20230116080101_add_attachment_avatar_to_projects.rb:4:in block in up' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration/compatibility.rb:108:in block in change_table'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration/compatibility.rb:43:in block in change_table' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/schema_statements.rb:490:in change_table'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:929:in block in method_missing' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:897:in block in say_with_time'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:897:in say_with_time' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:918:in method_missing'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration/compatibility.rb:43:in change_table' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration/compatibility.rb:108:in change_table'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:658:in method_missing' /var/www/html/rails/workshop_project3/db/migrate/20230116080101_add_attachment_avatar_to_projects.rb:3:in up'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:830:in up' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:870:in public_send'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:870:in exec_migration' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:851:in block (2 levels) in migrate'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:850:in block in migrate' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in with_connection'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:849:in migrate' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1037:in migrate'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1329:in block in execute_migration_in_transaction' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1380:in block in ddl_transaction'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in block in transaction' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/transaction.rb:319:in block in within_new_transaction'
/usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in block (2 levels) in synchronize' /usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in handle_interrupt'
/usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in block in synchronize' /usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in handle_interrupt'
/usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in synchronize' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/transaction.rb:317:in within_new_transaction'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in transaction' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/transactions.rb:209:in transaction'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1380:in ddl_transaction' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1328:in execute_migration_in_transaction'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1302:in each' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1302:in migrate_without_lock'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1253:in migrate' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1086:in up'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1061:in migrate' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/tasks/database_tasks.rb:237:in migrate'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:92:in block (3 levels) in <main>' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in each'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in block (2 levels) in <main>' /usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:10:in block in fork'
/usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:10:in block in fork' /usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:8:in fork'
/usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:8:in fork' /usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:27:in fork'
/usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:8:in fork' /usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:27:in fork'
internal:/usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb:85:in require' <internal:/usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in require'
-e:1:in `'
Caused by:
ArgumentError: wrong number of arguments (given 3, expected 2)
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/schema_definitions.rb:603:in column' /usr/share/rvm/gems/ruby-3.0.0/gems/paperclip-6.1.0/lib/paperclip/schema.rb:54:in block (2 levels) in attachment'
/usr/share/rvm/gems/ruby-3.0.0/gems/paperclip-6.1.0/lib/paperclip/schema.rb:52:in each_pair' /usr/share/rvm/gems/ruby-3.0.0/gems/paperclip-6.1.0/lib/paperclip/schema.rb:52:in block in attachment'
/usr/share/rvm/gems/ruby-3.0.0/gems/paperclip-6.1.0/lib/paperclip/schema.rb:51:in each' /usr/share/rvm/gems/ruby-3.0.0/gems/paperclip-6.1.0/lib/paperclip/schema.rb:51:in attachment'
/var/www/html/rails/workshop_project3/db/migrate/20230116080101_add_attachment_avatar_to_projects.rb:4:in block in up' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration/compatibility.rb:108:in block in change_table'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration/compatibility.rb:43:in block in change_table' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/schema_statements.rb:490:in change_table'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:929:in block in method_missing' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:897:in block in say_with_time'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:897:in say_with_time' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:918:in method_missing'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration/compatibility.rb:43:in change_table' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration/compatibility.rb:108:in change_table'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:658:in method_missing' /var/www/html/rails/workshop_project3/db/migrate/20230116080101_add_attachment_avatar_to_projects.rb:3:in up'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:830:in up' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:870:in public_send'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:870:in exec_migration' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:851:in block (2 levels) in migrate'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:850:in block in migrate' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/connection_pool.rb:462:in with_connection'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:849:in migrate' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1037:in migrate'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1329:in block in execute_migration_in_transaction' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1380:in block in ddl_transaction'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in block in transaction' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/transaction.rb:319:in block in within_new_transaction'
/usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in block (2 levels) in synchronize' /usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in handle_interrupt'
/usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in block in synchronize' /usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in handle_interrupt'
/usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in synchronize' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/transaction.rb:317:in within_new_transaction'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in transaction' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/transactions.rb:209:in transaction'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1380:in ddl_transaction' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1328:in execute_migration_in_transaction'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1302:in each' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1302:in migrate_without_lock'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1253:in migrate' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1086:in up'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/migration.rb:1061:in migrate' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/tasks/database_tasks.rb:237:in migrate'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:92:in block (3 levels) in <main>' /usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in each'
/usr/share/rvm/gems/ruby-3.0.0/gems/activerecord-6.1.7/lib/active_record/railties/databases.rake:90:in block (2 levels) in <main>' /usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:10:in block in fork'
/usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:10:in block in fork' /usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:8:in fork'
/usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:8:in fork' /usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:27:in fork'
/usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:8:in fork' /usr/share/rvm/gems/ruby-3.0.0/gems/activesupport-6.1.7/lib/active_support/fork_tracker.rb:27:in fork'
internal:/usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb:85:in require' <internal:/usr/share/rvm/rubies/ruby-3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in require'
-e:1:in `'
Tasks: TOP => db:migrate
expecting for execution of migration on rails6
Related
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
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.
For some reason or another my Ruby on Rails application is telling me that it can't run migrations. I an unsure how to fix this. I created a table with no information by accident. I then tried to delete the migration file and the table that it created. When I try to run the migration command it gives me this error:
rails aborted!
Don't know how to build task 'db:migration' (see --tasks)
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/railties-5.0.0/lib/rails/commands/rake_proxy.rb:13:in `block in run_rake_task'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/railties-5.0.0/lib/rails/commands/rake_proxy.rb:10:in `run_rake_task'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/railties-5.0.0/lib/rails/commands/commands_tasks.rb:51:in `run_command!'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/railties-5.0.0/lib/rails/commands.rb:18:in `<top (required)>'
/home/ubuntu/workspace/saasapp/bin/rails:9:in `require'
/home/ubuntu/workspace/saasapp/bin/rails:9:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/spring-1.7.2/lib/spring/client.rb:30:in `run'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/spring-1.7.2/bin/spring:49:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>'
/home/ubuntu/workspace/saasapp/bin/spring:15:in `require'
/home/ubuntu/workspace/saasapp/bin/spring:15:in `<top (required)>'
bin/rails:3:in `load'
bin/rails:3:in `<main>'
(See full trace by running task with --trace)
Can someone please help me fix this issue. I need to remove the existing table so that I can create the correct one. It won't populate my schema file.
This is the error that I get when I run rake db:migrate
rake db:migrate
== 20170322214259 CreateProfiles: migrating ===================================
-- change_table(:profiles)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: Cannot add a NOT NULL column with default value NULL: ALTER TABLE "profiles" ADD "created_at" datetime NOT NULL
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in initialize'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:innew'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in prepare'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:137:inexecute'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in block in execute'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:566:inblock in log'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activesupport-5.0.0/lib/active_support/notifications/instrumenter.rb:21:in instrument'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:560:inlog'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in execute'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:547:inadd_column'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:373:in add_column'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:1096:inadd_timestamps'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:525:in timestamps'
/home/ubuntu/workspace/saasapp/db/migrate/20170322214259_create_profiles.rb:11:inblock in change'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:443:in change_table'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:845:inblock in method_missing'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:814:in block in say_with_time'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:814:insay_with_time'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:834:in method_missing'
/home/ubuntu/workspace/saasapp/db/migrate/20170322214259_create_profiles.rb:3:inchange'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:788:in exec_migration'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:772:inblock (2 levels) in migrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:771:in block in migrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:inwith_connection'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:770:in migrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:950:inmigrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1211:in block in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1279:inblock in ddl_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in block in transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:189:inwithin_new_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/transactions.rb:211:intransaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1279:in ddl_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1210:inexecute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1183:in block in migrate_without_lock'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1182:ineach'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1182:in migrate_without_lock'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1133:inmigrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1005:in up'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:983:inmigrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/tasks/database_tasks.rb:161:in migrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/railties/databases.rake:58:inblock (2 levels) in '
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/rake-12.0.0/exe/rake:27:in <top (required)>'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/bin/ruby_executable_hooks:15:ineval'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/bin/ruby_executable_hooks:15:in <main>'
ActiveRecord::StatementInvalid: SQLite3::SQLException: Cannot add a NOT NULL column with default value NULL: ALTER TABLE "profiles" ADD "created_at" datetime NOT NULL
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:ininitialize'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in new'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:inprepare'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:137:in execute'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:inblock in execute'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:566:in block in log'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activesupport-5.0.0/lib/active_support/notifications/instrumenter.rb:21:ininstrument'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:560:in log'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:inexecute'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:547:in add_column'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:373:inadd_column'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:1096:in add_timestamps'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:525:intimestamps'
/home/ubuntu/workspace/saasapp/db/migrate/20170322214259_create_profiles.rb:11:in block in change'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:443:inchange_table'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:845:in block in method_missing'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:814:inblock in say_with_time'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:814:in say_with_time'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:834:inmethod_missing'
/home/ubuntu/workspace/saasapp/db/migrate/20170322214259_create_profiles.rb:3:in change'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:788:inexec_migration'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:772:in block (2 levels) in migrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:771:inblock in migrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in with_connection'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:770:inmigrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:950:in migrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1211:inblock in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1279:in block in ddl_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:232:inblock in transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:189:in within_new_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:232:intransaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/transactions.rb:211:in transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1279:inddl_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1210:in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1183:inblock in migrate_without_lock'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1182:in each'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1182:inmigrate_without_lock'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1133:in migrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1005:inup'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:983:in migrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/tasks/database_tasks.rb:161:inmigrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/railties/databases.rake:58:in block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/rake-12.0.0/exe/rake:27:in'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/bin/ruby_executable_hooks:15:in eval'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/bin/ruby_executable_hooks:15:in'
SQLite3::SQLException: Cannot add a NOT NULL column with default value NULL
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in initialize'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:innew'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:91:in prepare'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/sqlite3-1.3.13/lib/sqlite3/database.rb:137:inexecute'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in block in execute'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:566:inblock in log'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activesupport-5.0.0/lib/active_support/notifications/instrumenter.rb:21:in instrument'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract_adapter.rb:560:inlog'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:232:in execute'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:547:inadd_column'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:373:in add_column'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:1096:inadd_timestamps'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:525:in timestamps'
/home/ubuntu/workspace/saasapp/db/migrate/20170322214259_create_profiles.rb:11:inblock in change'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:443:in change_table'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:845:inblock in method_missing'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:814:in block in say_with_time'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:814:insay_with_time'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:834:in method_missing'
/home/ubuntu/workspace/saasapp/db/migrate/20170322214259_create_profiles.rb:3:inchange'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:788:in exec_migration'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:772:inblock (2 levels) in migrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:771:in block in migrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:inwith_connection'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:770:in migrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:950:inmigrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1211:in block in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1279:inblock in ddl_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in block in transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/transaction.rb:189:inwithin_new_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/connection_adapters/abstract/database_statements.rb:232:in transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/transactions.rb:211:intransaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1279:in ddl_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1210:inexecute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1183:in block in migrate_without_lock'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1182:ineach'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1182:in migrate_without_lock'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1133:inmigrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:1005:in up'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/migration.rb:983:inmigrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/tasks/database_tasks.rb:161:in migrate'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/activerecord-5.0.0/lib/active_record/railties/databases.rake:58:inblock (2 levels) in '
/usr/local/rvm/gems/ruby-2.3.0#saasapp/gems/rake-12.0.0/exe/rake:27:in <top (required)>'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/bin/ruby_executable_hooks:15:ineval'
/usr/local/rvm/gems/ruby-2.3.0#saasapp/bin/ruby_executable_hooks:15:in `'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
In addition to my comment suggesting you use rake db:migrate instead of rake db:migration:
I also suggest you look into rake db:rollback if you find you've made a mistake while generating your model/migration.
I believe you've used migration instead of migrate
rake db:migrate
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.
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