Heroku运行rake db:migrate命令错误

时间:2013-06-21 14:31:06

标签: ruby-on-rails heroku rake

我创建了rails app遵循此guid https://devcenter.heroku.com/articles/rails4-getting-started。但是当我运行Heroku run rake db:migrate命令时返回错误:Error: Permission denied - connect(2) (Errno::EACCES)

已更新 迁移

class CreatePosts < ActiveRecord::Migration
  def change
    create_table :posts do |t|
      t.string :tilte
      t.timestamps
    end
  end
end

UPDTE 2 heroku配置

=== powerful-eyrie-5396 Config Vars                                                                                                                                                               
DATABASE_URL:                 postgres://bqfsdarajfpdlk:4nU5FON87juyFwSdaX7Sr3Aicl@ec2-54-225-89-245.compute-1.amazonaws.com:5432/d65593ob81m9g8                                                  
HEROKU_POSTGRESQL_COBALT_URL: postgres://bqfsdarajfpdlk:4nU5FON87juyFwSdaX7Sr3Aicl@ec2-54-225-89-245.compute-1.amazonaws.com:5432/d65593ob81m9g8

更新3 heroku命令回溯

Error:       Permission denied - connect(2) (Errno::EACCES)                                                                                                           
Backtrace:   /var/lib/stickshift/51bef7595973caa43f000531/app-root/data/lib/ruby/gems/gems/heroku-2.39.4/lib/heroku/client/rendezvous.rb:40:in `initialize'           
             /var/lib/stickshift/51bef7595973caa43f000531/app-root/data/lib/ruby/gems/gems/heroku-2.39.4/lib/heroku/client/rendezvous.rb:40:in `open'                 
             /var/lib/stickshift/51bef7595973caa43f000531/app-root/data/lib/ruby/gems/gems/heroku-2.39.4/lib/heroku/client/rendezvous.rb:40:in `block in start'       
             /opt/rh/ruby193/root/usr/share/ruby/timeout.rb:69:in `timeout'                                                                                           
             /var/lib/stickshift/51bef7595973caa43f000531/app-root/data/lib/ruby/gems/gems/heroku-2.39.4/lib/heroku/client/rendezvous.rb:31:in `start'                
             /var/lib/stickshift/51bef7595973caa43f000531/app-root/data/lib/ruby/gems/gems/heroku-2.39.4/lib/heroku/command/run.rb:132:in `rendezvous_session'        
             /var/lib/stickshift/51bef7595973caa43f000531/app-root/data/lib/ruby/gems/gems/heroku-2.39.4/lib/heroku/command/run.rb:119:in `run_attached'              
             /var/lib/stickshift/51bef7595973caa43f000531/app-root/data/lib/ruby/gems/gems/heroku-2.39.4/lib/heroku/command/run.rb:24:in `index'                      
             /var/lib/stickshift/51bef7595973caa43f000531/app-root/data/lib/ruby/gems/gems/heroku-2.39.4/lib/heroku/command.rb:206:in `run'                           
             /var/lib/stickshift/51bef7595973caa43f000531/app-root/data/lib/ruby/gems/gems/heroku-2.39.4/lib/heroku/cli.rb:28:in `start'                              
             /var/lib/stickshift/51bef7595973caa43f000531/app-root/data/lib/ruby/gems/gems/heroku-2.39.4/bin/heroku:17:in `<top (required)>'                          
             /var/lib/stickshift/51bef7595973caa43f000531/app-root/data/lib/ruby/gems/bin/heroku:23:in `load'                                                         
             /var/lib/stickshift/51bef7595973caa43f000531/app-root/data/lib/ruby/gems/bin/heroku:23:in `<main>'

2 个答案:

答案 0 :(得分:1)

这个问题解决了这个问题:

heroku run:detached rake db:migrate

答案 1 :(得分:0)

首先尝试重置数据库

heroku pg:reset DATABASE

然后

heroku run rake db:migrate