Reputation: 53
Using Rails 3.2.2, finishing up my migration from sqlite to postgres 9.2.
Used answer in this tutorial as a guide to install postgres and got stuck on Step 11 where it asks run heroku db:pull
where I get:
Failed to connect to database: Sequel::AdapterNotFound -> LoadError: cannot load such file --pg
I dug deeper and found db:pull (taps gem) is deprecated and came across a few recommendations for pg:transfer. Installed pg:transfer, but I get the impression it may be *nix only(?) as if I run: heroku pg:transfer
it returns:
Heroku client internal error. No such file or directory - .env (Errno:ENOENT)
If I do pg:transfer with -f and -t it gives me:
'env' is not recognized as an internal or external command, operable program or batch file
which means it isn't bound to path or doesn't exist as a command in windows.
Any thoughts on above errors?
Upvotes: 2
Views: 1835
Reputation: 53
Resolved by using pg:backups gem, which was recommended as the replacement for taps in the Heroku docs. I used this guide and uploaded my dump to dropbox for Heroku to pick it up.
Here's my exact list of steps and cmds:
heroku pgbackups:capture DATABASE
(this just backs up your heroku db)pg_dump -h localhost -U <pg username> -Fc dbname > dbname.dump
heroku pgbackups:restore DATABASE <paste dropbox download link here>
Dropbox trickiness: don't use the file link provided by Dropbox since it's an html redirect and will cause pg:restore to fail, even though the extension ends in .dump
Instead, navigate to your dropbox page and "right-click copy link address" on the Download button. That's the address you use in your pgbackups:restore (should be something like db.dump?token=<long random string>
)
A bit clunky, but got the job done. If you know a better way please let me know!
Upvotes: 1
Reputation: 5051
You need to make a .env file containing something like:
DATABASE_URL=postgres://localhost/myapp_development
References:
Upvotes: 0