How do I solve this?
I have no issues locally as I run rake db:migrate successfully. But on Heroku, I get this.
and when I run heroku run rake db:migrate --trace
$ heroku run rake db:migrate --trace
WARNING: Toolbelt is currently updating
Running rake db:migrate --trace on project-michelangelo... up, run.3483
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
Migrating to AddAttachmentAvatarToUsers (20160209034141)
== 20160209034141 AddAttachmentAvatarToUsers: migrating =======================
-- change_table(:users)
PG::DuplicateColumn: ERROR: column "avatar_file_name" of relation "users" alrea
dy exists
: ALTER TABLE "users" ADD COLUMN "avatar_file_name" character varying(255)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::DuplicateColumn: ERROR: column "avatar_file_name" of relation "users" alrea
dy exists
: ALTER TABLE "users" ADD COLUMN "avatar_file_name" character varying(255)/app/v
endor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connection_ad
apters/postgresql/database_statements.rb:128:in `async_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `block in execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:378:in `block in log'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.14/lib/active_support/notif
ications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:372:in `log'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:127:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:375:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/schema_statements.rb:398:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_definitions.rb:361:in `column'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:60:in
`block (2 levels) in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`each_pair'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`block in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`each'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`attachment'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:4:in `block in
up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:349:in `change_table'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:656:in `block in method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `block in say_with_time'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `say_with_time'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:648:in `method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:413:in `method_missing'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:3:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:565:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:605:in `exec_migration'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:586:in `block (2 levels) in migrate'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:585:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:294:in `with_connection'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:584:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:759:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:998:in `block in execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `block in ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `block in transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/transac
tions.rb:208:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:997:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:959:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:814:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:792:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/railtie
s/databases.rake:34:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in
execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in
invoke_with_call_chain'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_w
ith_call_chain'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `i
nvoke_task'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock (2 levels) in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `e
ach'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `r
un_with_threads'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `t
op_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `bl
ock in run'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `s
tandard_exception_handling'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `ru
n'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.1.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.1.0/bin/rake:23:in `<main>'
ActiveRecord::StatementInvalid: PG::DuplicateColumn: ERROR: column "avatar_file
_name" of relation "users" already exists
: ALTER TABLE "users" ADD COLUMN "avatar_file_name" character varying(255)
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `async_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `block in execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:378:in `block in log'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.14/lib/active_support/notif
ications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:372:in `log'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:127:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:375:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/schema_statements.rb:398:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_definitions.rb:361:in `column'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:60:in
`block (2 levels) in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`each_pair'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`block in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`each'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`attachment'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:4:in `block in
up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:349:in `change_table'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:656:in `block in method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `block in say_with_time'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `say_with_time'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:648:in `method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:413:in `method_missing'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:3:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:565:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:605:in `exec_migration'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:586:in `block (2 levels) in migrate'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:585:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:294:in `with_connection'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:584:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:759:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:998:in `block in execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `block in ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `block in transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/transac
tions.rb:208:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:997:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:959:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:814:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:792:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/railtie
s/databases.rake:34:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in
execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in
invoke_with_call_chain'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_w
ith_call_chain'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `i
nvoke_task'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock (2 levels) in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `e
ach'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `r
un_with_threads'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `t
op_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `bl
ock in run'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:176:in `s
tandard_exception_handling'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:75:in `ru
n'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.1.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.1.0/bin/rake:23:in `<main>'
PG::DuplicateColumn: ERROR: column "avatar_file_name" of relation "users" alrea
dy exists
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `async_exec'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:128:in `block in execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:378:in `block in log'
/app/vendor/bundle/ruby/2.1.0/gems/activesupport-4.1.14/lib/active_support/notif
ications/instrumenter.rb:20:in `instrument'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract_adapter.rb:372:in `log'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/database_statements.rb:127:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:375:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/postgresql/schema_statements.rb:398:in `add_column'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_definitions.rb:361:in `column'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:60:in
`block (2 levels) in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`each_pair'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:58:in
`block in attachment'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`each'
/app/vendor/bundle/ruby/2.1.0/gems/paperclip-4.3.5/lib/paperclip/schema.rb:57:in
`attachment'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:4:in `block in
up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/schema_statements.rb:349:in `change_table'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:656:in `block in method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `block in say_with_time'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:628:in `say_with_time'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:648:in `method_missing'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:413:in `method_missing'
/app/db/migrate/20160209034141_add_attachment_avatar_to_users.rb:3:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:565:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:605:in `exec_migration'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:586:in `block (2 levels) in migrate'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:585:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/connection_pool.rb:294:in `with_connection'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:584:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:759:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:998:in `block in execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `block in ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `block in transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/connect
ion_adapters/abstract/database_statements.rb:201:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/transac
tions.rb:208:in `transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:1044:in `ddl_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:997:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:959:in `block in migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:955:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:814:in `up'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/migrati
on.rb:792:in `migrate'
/app/vendor/bundle/ruby/2.1.0/gems/activerecord-4.1.14/lib/active_record/railtie
s/databases.rake:34:in `block (2 levels) in <top (required)>'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `call'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:240:in `block in
execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `each'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:235:in `execute'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:179:in `block in
invoke_with_call_chain'
/app/vendor/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:172:in `invoke_w
ith_call_chain'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/task.rb:165:in `invoke'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:150:in `i
nvoke_task'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock (2 levels) in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `e
ach'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:106:in `b
lock in top_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:115:in `r
un_with_threads'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:100:in `t
op_level'
/app/vendor/bundle/ruby/2.1.0/gems/rake-10.5.0/lib/rake/application.rb:78:in `bl
ock in run'
this is my schema.rb with users table only
create_table "users", force: true do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "first_name"
t.string "last_name"
t.string "avatar_file_name"
t.string "avatar_content_type"
t.integer "avatar_file_size"
t.datetime "avatar_updated_at"
end
add_index "users", ["email"], name: "index_users_on_email", unique: true
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
end
UPDATE:
db/migrate
class AddAttachmentAvatarToUsers < ActiveRecord::Migration
def self.up
change_table :users do |t|
t.attachment :avatar
end
end
def self.down
remove_attachment :users, :avatar
end
end
Related
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.
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
NEWBIE: I am trying to set up the membership part of my site. I ran the following commands:
git checkout development
git merge user_authentication
git checkout -b stripe_integration
bundle exec rails g migration CreatePlans
and received the this error:
ActiveRecord::PendingMigrationError: Migrations are pending. To
resolve this issue, run: bin/rake db:migrate RAILS_ENV=development
I've tried running it and other commands with no success. Below are links to other Stack Overflow answers to this issue that did not work for me and a full trace.
Link from Stack Overflow 1
Link from Stack Overflow 2
Full trace:
kmcrayton7:~/workspace (stripe_integration) $ bin/rake db:migrate RAILS_ENV=development
== 20151209220651 AddDeviseToUsers: migrating =================================
-- change_table(:users)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: duplicate column name: email: ALTER TABLE "users" ADD "email" varchar(255) DEFAULT '' NOT NULL/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `initialize'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `new'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `prepare'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:134:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:331:in `block in execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:331:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:454:in `add_column'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:490:in `block (3 levels) in <class:Table>'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (2 levels) in <class:Table>'
/home/ubuntu/workspace/db/migrate/20151209220651_add_devise_to_users.rb:5:in `block in up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:349:in `change_table'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:649:in `block in method_missing'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `block in say_with_time'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `say_with_time'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:641:in `method_missing'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:406:in `method_missing'
/home/ubuntu/workspace/db/migrate/20151209220651_add_devise_to_users.rb:3:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:558:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:598:in `exec_migration'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:578:in `block in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:577:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:752:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `block in transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:219:in `within_new_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `ddl_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:953:in `block in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:807:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:785:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `block in load'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
-e:1:in `<main>'
ActiveRecord::StatementInvalid: SQLite3::SQLException: duplicate column name: email: ALTER TABLE "users" ADD "email" varchar(255) DEFAULT '' NOT NULL
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `initialize'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `new'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `prepare'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:134:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:331:in `block in execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:331:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:454:in `add_column'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:490:in `block (3 levels) in <class:Table>'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (2 levels) in <class:Table>'
/home/ubuntu/workspace/db/migrate/20151209220651_add_devise_to_users.rb:5:in `block in up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:349:in `change_table'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:649:in `block in method_missing'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `block in say_with_time'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `say_with_time'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:641:in `method_missing'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:406:in `method_missing'
/home/ubuntu/workspace/db/migrate/20151209220651_add_devise_to_users.rb:3:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:558:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:598:in `exec_migration'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:578:in `block in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:577:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:752:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `block in transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:219:in `within_new_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `ddl_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:953:in `block in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:807:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:785:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `block in load'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
-e:1:in `<main>'
SQLite3::SQLException: duplicate column name: email
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `initialize'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `new'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:91:in `prepare'
/usr/local/rvm/gems/ruby-2.2.1/gems/sqlite3-1.3.11/lib/sqlite3/database.rb:134:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:331:in `block in execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:331:in `execute'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/sqlite3_adapter.rb:454:in `add_column'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:490:in `block (3 levels) in <class:Table>'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (2 levels) in <class:Table>'
/home/ubuntu/workspace/db/migrate/20151209220651_add_devise_to_users.rb:5:in `block in up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/schema_statements.rb:349:in `change_table'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:649:in `block in method_missing'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `block in say_with_time'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:621:in `say_with_time'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:641:in `method_missing'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:406:in `method_missing'
/home/ubuntu/workspace/db/migrate/20151209220651_add_devise_to_users.rb:3:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:558:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:598:in `exec_migration'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:578:in `block in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:577:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:752:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `block in ddl_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `block in transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:219:in `within_new_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in `transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/transactions.rb:208:in `transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:1038:in `ddl_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:953:in `block in migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `each'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:949:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:807:in `up'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/migration.rb:785:in `migrate'
/usr/local/rvm/gems/ruby-2.2.1/gems/activerecord-4.1.0/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `block in load'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:232:in `load_dependency'
/usr/local/rvm/gems/ruby-2.2.1/gems/activesupport-4.1.0/lib/active_support/dependencies.rb:241:in `load'
-e:1:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Which email should I remove from the add_devise_to_user.rb file?
class AddDeviseToUsers < ActiveRecord::Migration
def self.up
change_table(:users) do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Confirmable
# t.string :confirmation_token
# t.datetime :confirmed_at
# t.datetime :confirmation_sent_at
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
# Uncomment below if timestamps were not included in your original model.
# t.timestamps
end
add_index :users, :email, unique: true
add_index :users, :reset_password_token, unique: true
# add_index :users, :confirmation_token, unique: true
# add_index :users, :unlock_token, unique: true
end
def self.down
# By default, we don't want to make any assumption about how to roll back a migration when your
# model already existed. Please edit below which fields you would like to remove in this migration.
raise ActiveRecord::IrreversibleMigration
end
end
Looking into the AddDeviseToUsers migration error stack trace, you may notice that you have a duplicate email column. You already have an email column on the users table and that particular migration is trying to add another one.
I'd advise you to edit AddDeviseToUsers to remove the email column creation. If you're not familiar with Rails directory structure, you may find that file at db/migrate/xxxxxxxxxxx_add_devise_to_users.rb
I hope it helps.
I'm trying to do a rake db:migrate on RoR. However after running the command I get the following error (I've included trace as well). Can you please tell me how it can be soled? I have tried to rollback and repeat the procedure but it's not working.... :
Malions-MacBook-Air:omrails malionhoxhallari$ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Execute db:load_config
** Execute db:migrate
== 20141128222329 AddDeviseToUsers: migrating =================================
-- change_table(:users)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
SQLite3::SQLException: no such table: users: ALTER TABLE "users" ADD "email" varchar(255) DEFAULT '' NOT NULL/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:334:in `block in execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:334:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:457:in `add_column'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:490:in `block (3 levels) in <class:Table>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (2 levels) in <class:Table>'
/Users/malionhoxhallari/code/omrails/db/migrate/20141128222329_add_devise_to_users.rb:5:in `block in up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:349:in `change_table'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:649:in `block in method_missing'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `block in say_with_time'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `say_with_time'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:641:in `method_missing'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:406:in `method_missing'
/Users/malionhoxhallari/code/omrails/db/migrate/20141128222329_add_devise_to_users.rb:3:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:558:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:598:in `exec_migration'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:578:in `block in migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:577:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:752:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:991:in `block in execute_migration_in_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `block in ddl_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/transactions.rb:208:in `transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `ddl_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:990:in `execute_migration_in_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:952:in `block in migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:807:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:785:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:240:in `call'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:240:in `block in execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:235:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:235:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:165:in `invoke'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:156:in `invoke_task'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `block (2 levels) in top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `block in top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:121:in `run_with_threads'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:106:in `top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:84:in `block in run'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:182:in `standard_exception_handling'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:79:in `run'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/bin/rake:33:in `<top (required)>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/rake:23:in `load'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/rake:23:in `<main>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
ActiveRecord::StatementInvalid: SQLite3::SQLException: no such table: users: ALTER TABLE "users" ADD "email" varchar(255) DEFAULT '' NOT NULL
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:334:in `block in execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:334:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:457:in `add_column'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:490:in `block (3 levels) in <class:Table>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (2 levels) in <class:Table>'
/Users/malionhoxhallari/code/omrails/db/migrate/20141128222329_add_devise_to_users.rb:5:in `block in up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:349:in `change_table'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:649:in `block in method_missing'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `block in say_with_time'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `say_with_time'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:641:in `method_missing'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:406:in `method_missing'
/Users/malionhoxhallari/code/omrails/db/migrate/20141128222329_add_devise_to_users.rb:3:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:558:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:598:in `exec_migration'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:578:in `block in migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:577:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:752:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:991:in `block in execute_migration_in_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `block in ddl_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/transactions.rb:208:in `transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `ddl_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:990:in `execute_migration_in_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:952:in `block in migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:807:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:785:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:240:in `call'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:240:in `block in execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:235:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:235:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:165:in `invoke'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:156:in `invoke_task'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `block (2 levels) in top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `block in top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:121:in `run_with_threads'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:106:in `top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:84:in `block in run'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:182:in `standard_exception_handling'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:79:in `run'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/bin/rake:33:in `<top (required)>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/rake:23:in `load'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/rake:23:in `<main>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
SQLite3::SQLException: no such table: users
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:334:in `block in execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activesupport-4.1.8/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:334:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/sqlite3_adapter.rb:457:in `add_column'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:490:in `block (3 levels) in <class:Table>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_definitions.rb:489:in `block (2 levels) in <class:Table>'
/Users/malionhoxhallari/code/omrails/db/migrate/20141128222329_add_devise_to_users.rb:5:in `block in up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:349:in `change_table'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:649:in `block in method_missing'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `block in say_with_time'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:621:in `say_with_time'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:641:in `method_missing'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:406:in `method_missing'
/Users/malionhoxhallari/code/omrails/db/migrate/20141128222329_add_devise_to_users.rb:3:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:558:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:598:in `exec_migration'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:578:in `block in migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:577:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:752:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:991:in `block in execute_migration_in_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `block in ddl_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `block in transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:209:in `within_new_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/connection_adapters/abstract/database_statements.rb:201:in `transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/transactions.rb:208:in `transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:1037:in `ddl_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:990:in `execute_migration_in_transaction'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:952:in `block in migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:948:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:807:in `up'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/migration.rb:785:in `migrate'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/activerecord-4.1.8/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:240:in `call'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:240:in `block in execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:235:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:235:in `execute'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/Users/malionhoxhallari/.rvm/rubies/ruby-2.1.5/lib/ruby/2.1.0/monitor.rb:211:in `mon_synchronize'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:172:in `invoke_with_call_chain'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/task.rb:165:in `invoke'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:156:in `invoke_task'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `block (2 levels) in top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `each'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:112:in `block in top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:121:in `run_with_threads'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:106:in `top_level'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:84:in `block in run'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:182:in `standard_exception_handling'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/lib/rake/application.rb:79:in `run'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/gems/rake-10.4.0/bin/rake:33:in `<top (required)>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/rake:23:in `load'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/rake:23:in `<main>'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `eval'
/Users/malionhoxhallari/.rvm/gems/ruby-2.1.5/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => db:migrate
Did you follow all the steps in the Devise readme(https://github.com/plataformatec/devise)?
Make sure you ran:
rails g devise:install
and
rails g devise User
before migrating.
Since the first part of the trace shows: SQLite3::SQLException: no such table: users so the first thing I would do is check the migration file and schema.rb to see if you've created the users table properly.
Here's an example of a working schema.rb and migration using Devise:
schema.rb:
create_table "users", force: true do |t|
t.string "email", default: "", null: false
t.string "encrypted_password", default: "", null: false
t.string "reset_password_token"
t.datetime "reset_password_sent_at"
t.datetime "remember_created_at"
t.integer "sign_in_count", default: 0, null: false
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.string "role"
end
Corresponding migration to update schema:
class DeviseCreateUsers < ActiveRecord::Migration
def change
create_table(:users) do |t|
## Database authenticatable
t.string :email, null: false, default: ""
t.string :encrypted_password, null: false, default: ""
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, default: 0, null: false
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.inet :current_sign_in_ip
t.inet :last_sign_in_ip
## Confirmable
# t.string :confirmation_token
# t.datetime :confirmed_at
# t.datetime :confirmation_sent_at
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, default: 0, null: false
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
t.timestamps
end
add_index :users, :email, unique: true
add_index :users, :reset_password_token, unique: true
# add_index :users, :confirmation_token, unique: true
# add_index :users, :unlock_token, unique: true
end
end