Skip to content

Instantly share code, notes, and snippets.

@przbadu
Last active April 9, 2024 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save przbadu/d6a603bc231f1e7dea3f08f23cbbec30 to your computer and use it in GitHub Desktop.
Save przbadu/d6a603bc231f1e7dea3f08f23cbbec30 to your computer and use it in GitHub Desktop.
How to restore postgresql dump file into Heroku application using `pg_restore` command.

Use pg_restore to restore latest dump file

Sometimes heroku pg:copy fails, in that case, we can use pg_restore command

Get the credentials

heroku pg:credentials DATABASE_URL -a <app-name>

Restore

pg_restore --verbose --clean --no-acl --no-owner -h <host name> -U <username> -d <db name> -p 5432 latest.dump --password
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment