Home > Software engineering >  Where Heroku stored the latest.dump file, when I import db from Heroku to local Postgres?
Where Heroku stored the latest.dump file, when I import db from Heroku to local Postgres?

Time:10-18

This is how I import db from Heroku Postgres to local Postgres db:

  1. Back up your database from Heroku
heroku pg:backups:capture -a your-app-name
  1. Download the database from Heroku. The database will be downloaded as a latest.dump file to your computer
heroku pg:backups:download -a your-app-name
  1. Import latest.dump to Postgres (your local database) (if this is the first dump, you don't need to specify the number of dump)
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U your_local_db_username -d your_local_db_name latest.dump.[number of dump] 

I want to know where Heroku stored the latest.dump file from step number 2 in my computer. In which folder? Heroku silent about it...

CodePudding user response:

By default, it just puts it wherever you are on the filesystem when you run the command. If you didn't use the -a / --app argument, that's probably your project directory since Heroku would have to infer your app from your Git remotes.

You can use the -o / --output argument to put it elsewhere or give it a different name:

-o, --output=output  location to download to. Defaults to latest.dump
  • Related