Migrating your data from Heroku to ElephantSQL.
Now that you have a new blank database set up in ElephantSQL, we’ll run a program to copy your data from Heroku into it.
Navigate to the Postgres Migration Tool repo on GitHub in a new browser tab
Click the Gitpod button to open a new workspace
Run the script with the following command in the terminal
python3 reel2reel.py
In a different browser tab, go to your app in Heroku and select the Settings tab
Click the “Reveal Config Vars” button
Copy the value in the DATABASE_URL Config Var. It will start with postgres://
Return to Gitpod and paste in the URL you just copied into the terminal where prompted to provide your DATABASE_URL and click enter
In your original browser tab, get your ElephantSQL database URL. Again, it will start with postgres://
Return to Gitpod and paste in the URL where prompted
The data will now be downloaded from Heroku and uploaded to your ElephantSQL database
To test that your database has been moved successfully, return to ElephantSQL and select BROWSER
Click the “Table queries” button. If you see any options in the dropdown, your tables have been created
Select a table name you recognise, and then click “Execute”
You should see your data displayed relating to the table you selected
You have successfully created a new database instance and migrated all your data. Next we will take a look at what needs to be changed within your repository to prepare it for hosting on Render.com.