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:inblock 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:inlog' /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:inadd_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:inblock 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:insay_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:inchange' /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:inblock (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:inwith_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:inmigrate' /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:inblock 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:inwithin_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:intransaction' /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:inexecute_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:ineach' /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:inup' /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
Post a Comment