0

我很难将我最新的 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]: 

在此先感谢您的帮助

4

3 回答 3

0

最好的猜测是您有未运行的出色迁移。

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

对于其余的,它们是警告。你可以忽略它们,但你会看到,因为vendor/plugins你的项目中的文件夹可能是非空的,当 Rails 4 到来时,它会被弃用。

于 2012-09-22T03:30:23.913 回答
0

为了解决这个问题,我只是从它工作时开始检查我的 git,并逐步添加新功能并能够找到问题

于 2012-09-22T05:36:47.080 回答
0

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

Rake::Task["db:structure:dump"].clear unless Rails.env.development?
于 2013-10-08T21:04:57.177 回答