I am using my local environment on Mac OS X with Rails 4.
When trying to run my migration, it is not running.
I receive the following output:
*******-C02MGBVJFD57:myapp *************$ bundle exec rake db:migrate
Your Gemfile lists the gem faker (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
Your Gemfile lists the gem factory_girl_rails (>= 0) more than once.
You should probably keep only one of them.
While it's not a problem now, it could cause errors if you change the version of just one of them later.
== 20140815221246 AddPasswordDigestToUsers: migrating =========================
-- add_column(:users, :password_digest, :string)
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: Duplicate column name 'password_digest': ALTER TABLE `users` ADD `password_digest` varchar(255)/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `query'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `block in execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activesupport-4.1.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/mysql2_adapter.rb:228:in `execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:649:in `block in method_missing'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:621:in `block in say_with_time'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:621:in `say_with_time'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:641:in `method_missing'
/Users/*************/workspace/myapp/db/migrate/20140815221246_add_password_digest_to_users.rb:3:in `change'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:595:in `exec_migration'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:578:in `block in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:577:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:752:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:1040:in `ddl_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:953:in `block in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:949:in `each'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:949:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:807:in `up'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:785:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
ActiveRecord::StatementInvalid: Mysql2::Error: Duplicate column name 'password_digest': ALTER TABLE `users` ADD `password_digest` varchar(255)
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `query'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `block in execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activesupport-4.1.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/mysql2_adapter.rb:228:in `execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:649:in `block in method_missing'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:621:in `block in say_with_time'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:621:in `say_with_time'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:641:in `method_missing'
/Users/*************/workspace/myapp/db/migrate/20140815221246_add_password_digest_to_users.rb:3:in `change'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:595:in `exec_migration'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:578:in `block in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:577:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:752:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:1040:in `ddl_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:953:in `block in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:949:in `each'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:949:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:807:in `up'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:785:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
Mysql2::Error: Duplicate column name 'password_digest'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `query'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `block in execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:373:in `block in log'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activesupport-4.1.4/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_adapter.rb:367:in `log'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:303:in `execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/mysql2_adapter.rb:228:in `execute'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/schema_statements.rb:375:in `add_column'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:649:in `block in method_missing'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:621:in `block in say_with_time'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:621:in `say_with_time'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:641:in `method_missing'
/Users/*************/workspace/myapp/db/migrate/20140815221246_add_password_digest_to_users.rb:3:in `change'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:595:in `exec_migration'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:579:in `block (2 levels) in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:578:in `block in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in `with_connection'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:577:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:752:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:992:in `block in execute_migration_in_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:1040:in `ddl_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:991:in `execute_migration_in_transaction'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:953:in `block in migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:949:in `each'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:949:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:807:in `up'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/migration.rb:785:in `migrate'
/Users/*************/.rvm/gems/ruby-2.1.2#myapp/gems/activerecord-4.1.4/lib/active_record/railties/databases.rake:34:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Any idea what is wrong?
EDIT:
The schema for the users table below:
create_table "users", force: true do |t|
t.string "name"
t.string "email"
t.datetime "created_at"
t.datetime "updated_at"
t.string "password_digest"
t.string "remember_digest"
end
Users Migration:
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.string :email
t.string :password_digest
t.timestamps
end
end
end
class AddPasswordDigestToUsers < ActiveRecord::Migration
def change
add_column :users, :password_digest, :string
end
end
class AddRememberDigestToUsers < ActiveRecord::Migration
def change
add_column :users, :remember_digest, :string
end
end
The issue is happening because in your CreateUsers migration, you are already creating a users table with the password_digest column as evidenced by this line:
t.string :password_digest
Then, in your AddPasswordDigestToUsers migration, you're trying to add a column with the same name to the users table:
add_column :users, :password_digest, :string
This is where the migration failed with the error Mysql2::Error: Duplicate column name 'password_digest'.
Are you sure you need the AddPasswordDigestToUsers file? It doesn't seem like it because you already added the column in the CreateUsers migration.
I think you can simply delete the AddPasswordDigestToUsers migration file and try re-running bundle exec rake db:migrate.
Related
I have created a web app in rails and I was using sqlite3. Now I am trying to deploy it with heroku which uses pg but I am running into this error:
PG::UndefinedTable: ERROR: relation "user_profiles" does not exist
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:92:in `exec'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:92:in `block (2 levels) in execute'
/app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
/app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
/app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:91:in `block in execute'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:718:in `block (2 levels) in log'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:717:in `block in log'
/app/vendor/bundle/ruby/2.6.0/gems/activesupport-6.0.2.2/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract_adapter.rb:708:in `log'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/postgresql/database_statements.rb:90:in `execute'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/postgresql/schema_statements.rb:443:in `add_index'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:890:in `block in method_missing'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:858:in `block in say_with_time'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:858:in `say_with_time'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:879:in `method_missing'
/app/db/migrate/20200327044108_create_user_profiles.rb:10:in `block in change'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/schema_statements.rb:309:in `create_table'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:890:in `block in method_missing'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:858:in `block in say_with_time'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:858:in `say_with_time'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:879:in `method_missing'
/app/db/migrate/20200327044108_create_user_profiles.rb:3:in `change'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:828:in `exec_migration'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:812:in `block (2 levels) in migrate'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:811:in `block in migrate'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `with_connection'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:810:in `migrate'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:1001:in `migrate'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:1311:in `block in execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:1362:in `block in ddl_transaction'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:281:in `block in transaction'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:280:in `block in within_new_transaction'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:281:in `transaction'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/transactions.rb:212:in `transaction'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:1362:in `ddl_transaction'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:1310:in `execute_migration_in_transaction'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:1282:in `block in migrate_without_lock'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:1281:in `each'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:1281:in `migrate_without_lock'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:1229:in `block in migrate'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:1382:in `with_advisory_lock'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:1229:in `migrate'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:1061:in `up'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/migration.rb:1036:in `migrate'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/tasks/database_tasks.rb:238:in `migrate'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/railties/databases.rake:86:in `block (3 levels) in <main>'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/railties/databases.rake:84:in `each'
/app/vendor/bundle/ruby/2.6.0/gems/activerecord-6.0.2.2/lib/active_record/railties/databases.rake:84:in `block (2 levels) in <main>'
/app/vendor/bundle/ruby/2.6.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>'
/app/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `load'
/app/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:74:in `kernel_load'
/app/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli/exec.rb:28:in `run'
/app/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:463:in `exec'
/app/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/app/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:126:in `invoke_command'
/app/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor.rb:387:in `dispatch'
/app/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:27:in `dispatch'
/app/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/vendor/thor/lib/thor/base.rb:466:in `start'
/app/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/cli.rb:18:in `start'
/app/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/exe/bundle:30:in `block in <top (required)>'
/app/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/lib/bundler/friendly_errors.rb:124:in `with_friendly_errors'
/app/vendor/bundle/ruby/2.6.0/gems/bundler-1.17.3/exe/bundle:22:in `<top (required)>'
/app/bin/bundle:104:in `load'
/app/bin/bundle:104:in `<main>'
I've looked around a bit but still cant get it to work. I can see that it has to do with my user_profiles.
My user profiles model:
class UserProfile < ApplicationRecord
belongs_to :user, class_name: 'User', foreign_key: 'user_id'
validates_uniqueness_of :user_id
end
This is my user profile migrate:
class CreateUserProfiles < ActiveRecord::Migration[6.0]
def change
create_table :user_profiles do |t|
t.integer :user_id
t.string :name
t.integer :age
t.string :address
t.string :ptName
t.string :bio
t.timestamps
end
add_foreign_key :user_profiles, :users, column: :user_id
add_index :user_profiles, :user_id, unique: true
end
end
The error is occurring as when i go to view my app through heroku I see this: Application error. So I try and run: heroku run rake db:migrate and the error in the title occurs. I think it might have to do with Pg being more strict with foreign keys. Any suggestions?
From Rails 5 - when we reference a model, index on the foreign_key is automatically created.
Just do it like below -
class CreateUserProfiles < ActiveRecord::Migration[6.0]
def change
create_table :user_profiles do |t|
t.references :user, null: false, foreign_key: true
t.string :name
t.integer :age
t.string :address
t.string :ptName
t.string :bio
t.timestamps
end
end
end
Migration:
class AddUserIdToPhotos < ActiveRecord::Migration
def self.up
add_column :photos, :user_id, :integer
execute 'update photos inner join albums on albums.id = photos.album_id set photos.user_id = albums.user_id'
end
def self.down
remove_column :photos, :user_id
end
end
rake db:migrate, display error:
-- add_column(:photos, :user_id, :integer) -> 0.0010s
-- execute("update photos inner join albums on albums.id = photos.album_id set photos.user_id = albums.user_id") rake aborted!
StandardError: An error has occurred, this and all later migrations
canceled:
SQLite3::SQLException: near "inner": syntax error: update photos inner
join albums on albums.id = photos.album_id set photos.user_id =
albums.user_id/home/borowskiy/projects/galaxy/bdsmgalaxy/db/migrate/20110731191428_add_user_id_to_photos.rb:4:in
`up'
with trace:
SQLite3::SQLException: near "inner": syntax error: update photos inner join albums on albums.id = photos.album_id set photos.user_id = albums.user_id/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `initialize'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `new'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:91:in `prepare'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/sqlite3-1.3.10/lib/sqlite3/database.rb:134:in `execute'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/sqlite_adapter.rb:278:in `block in execute'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract_adapter.rb:280:in `block in log'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activesupport-3.2.22/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rack-mini-profiler-0.9.7/lib/patches/db/activerecord.rb:17:in `log_with_miniprofiler'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/sqlite_adapter.rb:278:in `execute'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:466:in `block in method_missing'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:438:in `block in say_with_time'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/benchmark.rb:281:in `measure'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:438:in `say_with_time'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:458:in `method_missing'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:334:in `method_missing'
/home/borowskiy/projects/galaxy/bdsmgalaxy/db/migrate/20110731191428_add_user_id_to_photos.rb:4:in `up'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:370:in `up'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:410:in `block (2 levels) in migrate'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/benchmark.rb:281:in `measure'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:410:in `block in migrate'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/connection_pool.rb:129:in `with_connection'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:389:in `migrate'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:528:in `migrate'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:720:in `block (2 levels) in migrate'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:775:in `call'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:775:in `block in ddl_transaction'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/transactions.rb:208:in `transaction'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:775:in `ddl_transaction'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:719:in `block in migrate'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:700:in `each'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:700:in `migrate'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:570:in `up'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/migration.rb:551:in `migrate'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.22/lib/active_record/railties/databases.rake:193:in `block (2 levels) in <top (required)>'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `call'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:240:in `block in execute'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `each'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:235:in `execute'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:179:in `block in invoke_with_call_chain'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/2.0.0/monitor.rb:211:in `mon_synchronize'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:172:in `invoke_with_call_chain'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/task.rb:165:in `invoke'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:150:in `invoke_task'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block (2 levels) in top_level'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `each'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:106:in `block in top_level'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:115:in `run_with_threads'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:100:in `top_level'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:78:in `block in run'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:176:in `standard_exception_handling'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/lib/rake/application.rb:75:in `run'
/home/borowskiy/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/rake-10.4.2/bin/rake:33:in `<top (required)>'
/home/borowskiy/.rbenv/versions/2.0.0-p247/bin/rake:23:in `load'
/home/borowskiy/.rbenv/versions/2.0.0-p247/bin/rake:23:in `<main>'
Tasks: TOP => db:migrate
You SQL query is wrong. The correct sql update query should be like this
update photos set photos.user_id = albums.user_id from albums where albums.id = photos.album_id
Please change your migration file to this
class AddUserIdToPhotos < ActiveRecord::Migration
def self.up
add_column :photos, :user_id, :integer
execute "update photos set photos.user_id = albums.user_id from albums where albums.id = photos.album_id"
end
def self.down
remove_column :photos, :user_id
end
end
and run it again.
I've got a problem trying to run a migration in my rails project.
I have a simple addition of two tables:
class ModifyCurrentTablesToNewDesign < ActiveRecord::Migration
def change
# Some other migrations...
# New Table Companies
create_table :companies do |t|
t.string :name
end
# New Table Teams
create_table :teams do |t|
t.string :name
t.belongs_to :companies, :index => true, :foreign_key => true
end
# Some oooother migrations...
end
end
And when a run it, I've got this:
-- create_table(:companies)
-> 0.0036s
-- create_table(:teams)
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:
PG::UndefinedColumn: ERROR: column "company_id" referenced in foreign key constraint does not exist
: ALTER TABLE "teams" ADD CONSTRAINT "fk_rails_e080df8a94"
FOREIGN KEY ("company_id")
REFERENCES "companies" ("id")
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `async_exec'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:155:in `block in execute'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:473:in `block in log'
/Library/Ruby/Gems/2.0.0/gems/activesupport-4.2.3/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract_adapter.rb:467:in `log'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/postgresql/database_statements.rb:154:in `execute'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:762:in `add_foreign_key'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:217:in `block in create_table'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:216:in `each_pair'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/schema_statements.rb:216:in `create_table'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:661:in `block in method_missing'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:631:in `block in say_with_time'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:631:in `say_with_time'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:651:in `method_missing'
/Users/julian/Development/sikuani/plataforma-eventos/db/migrate/20160121164754_modify_current_tables_to_new_design.rb:35:in `change'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:605:in `exec_migration'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:589:in `block (2 levels) in migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:588:in `block in migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:587:in `migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:764:in `migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:994:in `block in execute_migration_in_transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:1040:in `block in ddl_transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/transactions.rb:220:in `transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:1040:in `ddl_transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:993:in `execute_migration_in_transaction'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:955:in `block in migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:951:in `each'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:951:in `migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:819:in `up'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/migration.rb:797:in `migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/tasks/database_tasks.rb:137:in `migrate'
/Library/Ruby/Gems/2.0.0/gems/activerecord-4.2.3/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Isn't supposed that when the table companies is created, by default a column id is created within? Can you see why could this be happening?
It seems you have a 1:M relationship between companies and teams.
You need to use the singular because a team belongs to a single company, not multiple companies.
t.belongs_to :company, :index => true, :foreign_key => true
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