Please refer to previous article to understand the names we are using in this article.
1heroku pg:backups:capture -a wheel-staging
1heroku pg:backups:download -a wheel-staging
It will download a file called latest.dump
.
1pg_restore --verbose --clean --no-owner --no-privileges --dbname=wheel_development latest.dump
In the above case replace wheel_development
with the name of the database you have.
You might get error something siimilar to as shown below.
1pg_restore: [archiver] unsupported version (1.13) in file header
It probably means that the version of pg_dump
used by heroku is not as the version we are running locally.
First let's check the version running in heroku.
1> heroku run bash -a wheel-staging
2> pg_dump --version
3
4pg_dump (PostgreSQL) 10.3 (Ubuntu 10.3-1.pgdg14.04+1)
It seems heroku is using version 10.3.
Now let's check our local version of pg_restore
.
1> pg_restore --version
2
3pg_restore (PostgreSQL) 10.0
As we can see that heroku used pg_dump
version "10.3".
Our pg_restore
version is "10.0"
Time to upgrade postgresql. Execute brew upgrade postgresql
.