18

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?

John Bachir
  • 22,495
  • 29
  • 154
  • 227
Paul
  • 25,812
  • 38
  • 124
  • 247
  • What's in your Gemfile? It might be that you have a gem that is trying to execute some code after the migrations that depends on that pg_dump. There used to be an error message I would get after every rake task run that had to do with Test::Unit being installed when I was using RSpec for testing - somewhat of a similar problem – jakeonrails Sep 19 '12 at 20:21
  • 1
    Take a look at this SO question: http://stackoverflow.com/questions/10248893/rake-dbstructuredump-fails-under-postgresql-rails-3-2 It may be that you are using a version of Rails that has this bug/issue - what version are you using? – jakeonrails Sep 19 '12 at 20:23

1 Answers1

50

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?
kch
  • 77,385
  • 46
  • 136
  • 148