Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
885 views
in Technique[技术] by (71.8m points)

ruby - Error when doing rake db:migrate on Heroku

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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?

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...