So I'm following the http://www.railstutorial.org/book, and evrything works fine locally (running sqlight3).
I get the following error when I try
heroku run rake db:migrate
This is what the error message looks like
Running
rake db:migrate
attached to terminal... up, run.4049 Migrating to AddPasswordDigestToUsers (20140817014655) == 20140817014655 AddPasswordDigestToUsers: migrating ========================= -- add_column(:users, :password_digest, :string) PG::Error: ERROR: column "password_digest" of relation "users" already exists : ALTER TABLE "users" ADD COLUMN "password_digest" character varying(255) rake aborted! StandardError: An error has occurred, this and all later migrations canceled:PG::Error: ERROR: column "password_digest" of relation "users" already 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 by running task with --trace)
I already tried heroku pg:reset DATABASE_URL and then retrying. Also tried adding /spec, /lib, /script, /features, /cucumber.yml to .slugignore
This is what my schema looks like:
ActiveRecord::Schema.define(version: 20140818041701) do
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_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 this is what my password digest migration looks like
class AddPasswordDigestToUsers < ActiveRecord::Migration
def change
add_column :users, :password_digest, :string
end
end