Migrate from Heroku to Neon Postgres
This guide describes how to import your data from Heroku Postgres to Neon.
The instructions assume that you have installed the Heroku CLI, which is used to transfer data from Heroku. For installation instructions, see The Heroku CLI.
To migrate your data from Heroku to Neon:
- Create a Neon project and copy the connection string
- Retrieve your Heroku app name and database name
- Import your data
- Verify that your data was imported
Create a Neon project and copy the connection string
-
Navigate to the Projects page in the Neon Console.
-
Click New Project.
-
Specify your project settings and click Create Project.
-
After creating a project, you are directed to the Neon Dashboard, where a connection string with your password is provided under Connection Details. Copy the connection string. It is required to import your data from Heroku.
The example connection string used the instructions that follow is:
Retrieve your Heroku app name and database name
- Log in to Heroku and select the project you want to import data from.
- Select Overview and copy the name of the Heroku Postgres database, which appears under Installed add-ons.
- Click Settings and copy your Heroku App Name.
note
You can also retrieve the Heroku Postgres database name using the following Heroku CLI command:
where <app>
is the Heroku App Name.
For example:
Import your data
From your terminal, run the following Heroku CLI command:
where:
[app]
is the name of the Heroku app[heroku-pg-database]
is the name of the Heroku PostgreSQL database[neon-connection-string]
is the Neon connection string
For example:
Verify that your data was imported
- Log in to the Neon Console.
- Select the Neon project that you transferred data to.
- Select the Tables tab.
- In the sidebar, verify that your database tables appear under the Tables heading.
Need help?
Join our Discord Server to ask questions or see what others are doing with Neon. Users on paid plans can open a support ticket from the console. For more details, see Getting Support.