Rails Postgres部署到heroku问题

时间:2012-09-22 02:26:57

标签: ruby-on-rails ruby postgresql heroku

我很难将最新的rails 3.2应用程序推送到heroku。我之前没有遇到任何问题,我一直在推动它,自上次工作提交以来我所做的最新事情是为postgres添加了一个hstore列和一个模型的联合。这些都可以在我和其他计算机上完美运行。

正在运行

heroku run rake db:migrate我得到以下输出:

james@James-PC:~/tendersave$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.1
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
/app/vendor/bundle/ruby/1.9.1/bin/rake: No such file or directory - pg_dump -i -s -x -O -f /app/db/structure.sql  d36q1tfb51f169

注意最后一行的错误

同样在运行heroku run db:setup时我得到了这个:

james@James-PC:~/tendersave$ heroku run rake db:setup
Running `rake db:setup` attached to terminal... up, run.1
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/1/4/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
d36q1tfb51f169 already exists
sh: psql: not found

再次在最后一行出现错误。

然后,如果我检查heroku的日志,我会得到以下内容(我认为因为它没有运行迁移):

2012-09-22T02:24:06+00:00 app[web.1]: Started GET "/" for 203.173.199.11 at 2012-09-22 02:24:06 +0000
2012-09-22T02:24:06+00:00 app[web.1]: Processing by ProposalsController#index as HTML
2012-09-22T02:24:06+00:00 app[web.1]:   Rendered proposals/index.html.erb within layouts/application (65.2ms)
2012-09-22T02:24:06+00:00 app[web.1]: Completed 500 Internal Server Error in 295ms
2012-09-22T02:24:06+00:00 app[web.1]: 
2012-09-22T02:24:06+00:00 app[web.1]: ActionView::Template::Error (PG::Error: ERROR:  relation "proposals" does not exist
2012-09-22T02:24:06+00:00 app[web.1]: LINE 4:              WHERE a.attrelid = '"proposals"'::regclass
2012-09-22T02:24:06+00:00 app[web.1]:                                         ^
2012-09-22T02:24:06+00:00 app[web.1]: :             SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
2012-09-22T02:24:06+00:00 app[web.1]:               FROM pg_attribute a LEFT JOIN pg_attrdef d
2012-09-22T02:24:06+00:00 app[web.1]:                 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2012-09-22T02:24:06+00:00 app[web.1]:              WHERE a.attrelid = '"proposals"'::regclass
2012-09-22T02:24:06+00:00 app[web.1]:                AND a.attnum > 0 AND NOT a.attisdropped
2012-09-22T02:24:06+00:00 app[web.1]:              ORDER BY a.attnum
2012-09-22T02:24:06+00:00 app[web.1]: ):
2012-09-22T02:24:06+00:00 app[web.1]:     16:     <th></th>
2012-09-22T02:24:06+00:00 app[web.1]:     17:   </tr>
2012-09-22T02:24:06+00:00 app[web.1]:     18: 
2012-09-22T02:24:06+00:00 app[web.1]:     19: <% @proposals.each do |proposal| %>
2012-09-22T02:24:06+00:00 app[web.1]:     20:   <tr>
2012-09-22T02:24:06+00:00 app[web.1]:     21:     <td><%#= proposal.active %></td>
2012-09-22T02:24:06+00:00 app[web.1]:     22:     <td><%= proposal.type %></td>
2012-09-22T02:24:06+00:00 app[web.1]:   app/controllers/proposals_controller.rb:14:in `index'
2012-09-22T02:24:06+00:00 app[web.1]: 
2012-09-22T02:24:06+00:00 app[web.1]:   app/views/proposals/index.html.erb:19:in `_app_views_proposals_index_html_erb__922970733135020301_38000420'
2012-09-22T02:24:06+00:00 app[web.1]: 

提前感谢您的帮助

3 个答案:

答案 0 :(得分:0)

最好的猜测是,您有未运行的优秀迁移。

试试heroku run rake db:migrate。这应该清除relations do not exist错误。

其余的,他们是警告。您可以忽略它们,但是您看到了这一点,因为项目中的vendor/plugins文件夹可能非空,而当Rails 4到达时,这将被弃用。

答案 1 :(得分:0)

为了解决这个问题,我只是从它工作的时候经过我的git,并逐步添加了新的功能并且能够找到问题

答案 2 :(得分:0)

对于未来的浏览器,this question为我解答了这个问题。只需将其添加到Rakefile的底部:

Rake::Task["db:structure:dump"].clear unless Rails.env.development?
相关问题