Forked from nelldnine/gist:14cbe7cd05dcd6ef83ec1e7bab9f432f
Created
September 4, 2021 04:20
-
-
Save a1iraxa/008ffbb804a7319d875f93833e7148ce to your computer and use it in GitHub Desktop.
Heroku pg_dump
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You could just make your own pg_dump directly from your Heroku database. | |
First, get your postgres string using `heroku config:get DATABASE_URL`. | |
Look for the Heroku Postgres url (example: `HEROKU_POSTGRESQL_RED_URL: postgres://user3123:[email protected]:6212/db982398`), which format is `postgres://<username>:<password>@<host_name>:<port>/<dbname>`. | |
Next, run this on your command line: | |
pg_dump --host=<host_name> --port=<port> --username=<username> --password --dbname=<dbname> > output.sql | |
The terminal will ask for your password then run it and dump it into output.sql. | |
Then import it: | |
psql -d my_local_database -f output.sql | |
https://stackoverflow.com/a/22896985/4148220 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment