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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…