We recommend adding on your Heroku application the free add-on “Heroku Postgres” (1)(2).
Once installed, your Heroku application will contain an environment variable
DATABASE_URL with the credentials of your new created database (1) in the “Config Vars” section (2). Here you can add more if necessary (3).
Your new database has no data yet, so you will need to import your local data to this new one.
To do that, you first need to create a dump of your local database.
PGPASSWORD=secret pg_dump -h localhost -p 5416 -U forest forest_demo --no-owner --no-acl -f database.dump
Then, you need to import it to the Heroku database.
heroku pg:psql DATABASE_URL --app name_of_your_app < database.dump
At this stage, your Heroku application is entirely running with its own database.
N.B: You can make sure by checking the Heroku logs using the command :
heroku logs -t -a name_of_your_app