Migrating database from heroku to ubuntu

You created your own server, and now you would like to move all of your apps on heroku to your custom server, right?

If so, first thing to do is to move your database from heroku to new server.

These are the steps to do so:

Make DB backup on heroku

heroku pg:backups:capture --app sushi

Download your database

heroku pg:backups:download

Upload your download dump to server via SSH

scp -P 22 latest.dump [email protected]:~/

Then import latest dump into your newly created database

pg_restore --verbose --clean --no-acl --no-owner -h localhost -U ubuntu -d opend_production ~/latest.dump