ruby on rails - Error trying to deploy to heroku (following ror tutorial) PG::Error: ERROR: column "password_digest" of relation "users" already exists -


so i'm following http://www.railstutorial.org/book, , evrything works fine locally (running sqlight3).

i following error when try

heroku run rake db:migrate

this error message looks like

running rake db:migrate attached terminal... up, run.4049 migrating addpassworddigesttousers (20140817014655) == 20140817014655 addpassworddigesttousers: migrating ========================= -- add_column(:users, :password_digest, :string) pg::error: error: column "password_digest" of relation "users" exists : alter table "users" add column "password_digest" character varying(255) rake aborted! standarderror: error has occurred, , later migrations canceled:

pg::error: error: column "password_digest" of relation "users" exists : alter table "users" add column "password_digest" character varying(255)/app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in exec' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in block in execute' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:442:in block in log' /app/vendor/bundle/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/notifications/instrumenter.rb:20:in instrument' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract_adapter.rb:437:in log' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/connection_adapters/postgresql/database_statements.rb:127:in execute' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract/schema_statements.rb:360:in add_column' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/connection_adapters/postgresql/schema_statements.rb:395:in add_column' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:629:in block in method_missing' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:601:in block in say_with_time' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:601:in say_with_time' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:621:in method_missing' /app/db/migrate/20140817014655_add_password_digest_to_users.rb:3:in change' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:575:in exec_migration' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:559:in block (2 levels) in migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:558:in block in migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:294:in with_connection' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:557:in migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:713:in migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:963:in block in execute_migration_in_transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:1009:in block in ddl_transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:203:in block in transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:211:in within_new_transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/connection_adapters/abstract/database_statements.rb:203:in transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/transactions.rb:209:in transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:1009:in ddl_transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:962:in execute_migration_in_transaction' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:924:in block in migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:920:in each' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:920:in migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:768:in up' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/migration.rb:746:in migrate' /app/vendor/bundle/ruby/2.0.0/gems/activerecord-4.0.8/lib/active_record/railties/databases.rake:42:in `block (2 levels) in ' tasks: top => db:migrate (see full trace running task --trace)

i tried heroku pg:reset database_url , retrying. tried adding /spec, /lib, /script, /features, /cucumber.yml .slugignore

this schema looks like:

activerecord::schema.define(version: 20140818041701)    create_table "users", force: true |t|     t.string   "name"     t.string   "email"     t.datetime "created_at"     t.datetime "updated_at"     t.string   "password_digest"     t.string   "remember_token"     t.boolean  "admin",           default: false   end    add_index "users", ["email"], name: "index_users_on_email", unique: true   add_index "users", ["remember_token"], name: "index_users_on_remember_token"  end 

and password digest migration looks like

class addpassworddigesttousers < activerecord::migration   def change     add_column :users, :password_digest, :string   end end 

you have password_digest column in table , migration addpassworddigesttousers trying create 1 that's why creating issue. remove migration addpassworddigesttousers , try run rake db:migrate again. sqlite3 not producing error in such cases. if write intege instead of integer in migration not produce error if use sqlite.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -