进行rake db时发生错误:在Heroku上进行迁移 [英] Error when doing rake db:migrate on Heroku
问题描述
heroku run rake db:migrate
执行所有迁移,然后在最后我总是收到以下消息:
/ app / vendor / bundle / ruby / 1.9.1 / bin / rake:没有这样的文件或目录 - pg_dump -i -s -x -O -f /app/db/structure.sql dan79p98fykovu
我无法将pg_dump添加到Heroku上的PATH中。
如何处理这个问题?
问题是rails试图转储一个新的 structure.sql
一旦迁移完成,并且由于 pg_dump
不存在而失败。为部署的应用程序生成一个新的structure.sql是毫无意义的,所以最好的解决方案是告诉rails不要。
编辑你的 Rakefile
并覆盖任务。
Rake :: Task [db:structure:dump]在结尾添加以下行应该这样做: .clear是否Rails.env.production?
when doing
heroku run rake db:migrate
all migrations are performed and then, at the end I always get following message:
/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 dan79p98fykovu
I can't add pg_dump to PATH on Heroku. How to deal with this?
The issue is that rails is trying to dump a new structure.sql
once the migration is complete, and failing because pg_dump
is not present. It's pointless to generate a new structure.sql for a deployed app, so the best solution is to tell rails not to.
Edit your Rakefile
and override the task. Adding the following line at the end of it should do it:
Rake::Task["db:structure:dump"].clear if Rails.env.production?
这篇关于进行rake db时发生错误:在Heroku上进行迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!