2013-08-26 140 views
0

我已經跑了「heroku pg:reset DATABASE」。但是,我仍然有這個錯誤。運行後Heroku運行rake db出現錯誤:migrate


Running `rake db:migrate` attached to terminal... up, run.8257 
== AddPasswordDigestToUsers: migrating ======================================= 
-- add_column(:users, :password_digest, :string) 
rake aborted! 
An error has occurred, this and all later migrations canceled: 

PG::Error: ERROR: relation "users" does not exist 
: ALTER TABLE "users" ADD COLUMN "password_digest" character varying(255)/app/ve 
ndor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/connection_adap 
ters/postgresql/database_statements.rb:128:in `exec' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/connecti 
on_adapters/postgresql/database_statements.rb:128:in `block in execute' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/connecti 
on_adapters/abstract_adapter.rb:425:in `block in log' 
/app/vendor/bundle/ruby/1.9.1/gems/activesupport-4.0.0/lib/active_support/notifi 
cations/instrumenter.rb:20:in `instrument' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/connecti 
on_adapters/abstract_adapter.rb:420:in `log' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/connecti 
on_adapters/postgresql/database_statements.rb:127:in `execute' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/connecti 
on_adapters/abstract/schema_statements.rb:360:in `add_column' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/connecti 
on_adapters/postgresql/schema_statements.rb:379:in `add_column' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:625:in `block in method_missing' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:597:in `block in say_with_time' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:597:in `say_with_time' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:617:in `method_missing' 
/app/db/migrate/20130822145844_add_password_digest_to_users.rb:3:in `change' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:571:in `exec_migration' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:555:in `block (2 levels) in migrate' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:554:in `block in migrate' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/connecti 
on_adapters/abstract/connection_pool.rb:294:in `with_connection' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:553:in `migrate' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:709:in `migrate' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:959:in `block in execute_migration_in_transaction' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:1005:in `block in ddl_transaction' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/connecti 
on_adapters/abstract/database_statements.rb:202:in `block in transaction' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/connecti 
on_adapters/abstract/database_statements.rb:210:in `within_new_transaction' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/connecti 
on_adapters/abstract/database_statements.rb:202:in `transaction' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/transact 
ions.rb:209:in `transaction' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:1005:in `ddl_transaction' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:958:in `execute_migration_in_transaction' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:920:in `block in migrate' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:916:in `each' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:916:in `migrate' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:764:in `up' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/migratio 
n.rb:742:in `migrate' 
/app/vendor/bundle/ruby/1.9.1/gems/activerecord-4.0.0/lib/active_record/railties 
/databases.rake:42:in `block (2 levels) in <top (required)>' 
Tasks: TOP => db:migrate 
(See full trace by running task with --trace) 

什麼建議嗎?

+0

'PG :: Error:ERROR:relation「users」does not exist' <<你缺少'users'表。運行'rake db:create'? – 2013-08-26 16:25:09

+0

我剛剛遇到類似這樣的問題。見http://stackoverflow.com/questions/18412099/heroku-open-fails-table-doesnt-exist-error-in-logs – dax

回答

0

很可能它嘗試在創建用戶表之前運行向用戶表中添加密碼摘要的遷移。您可以嘗試先創建數據庫或嘗試重置它。你可以通過做rake db創建db:create

相關問題