migrate database from Heroku

Posted April 26, 2021 960 views
Ruby on RailsPostgreSQLDigitalOcean App Platform

I’ve successfully deployed my Rails app on App Platform, and now I’m needing to import my database from Heroku. I tried to install heroku CLI on the console, but the sudo command does not exists:

$ sudo snap --install --classic heroku
bash: sudo: command not found

how can I import my database from Heroku to the app platform?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers

Hi there,

I believe that you should not run your database inside a web service on the App platform itself as the containers are recreated on each deployment and no data is persisted.

You would need to use a Managed database instead, you can follow the steps on how to do that here:


Hey @soporteAnemone,

Unless you use a Dockerfile, apps do not get root access. Regardless, I would recommend performing the migration locally on your computer:

  1. Follow the Heroku instructions on downloading a backup of your database
  2. Then, grab the connection details to your database from the App Platform control panel. Browse to your app, click the Settings tab, and then click the database component.
  3. Import the database export to your database.