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, the first thing to do is to move your database from Heroku to a new server.

Here are the steps that explain how to do it:

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 username@11.11.11.11:~/

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