Sync local sql dump to Hatchbox database
Piping1.
through
YouIf canyou use pg_restore and pipe its output directlyneed to the psql command that connects todownload the remotedatabase PostgreSQLfrom database.
- do
Command syntax:this:heroku
pg_restorepg:backups:capture/path/to/local/dumpfile--app|example-apppsqlheroku"host=remote_serverpg:backups:downloadport=5432--appdbname=remote_db_name user=remote_db_user"example-appReplace2.
theSendplaceholders with your specific details.
This methods assume that:
The remote PostgreSQL port is5432(replace as needed).remote_db_nameis the name of the remote database you wantfile torestoreserverinto.
scp remote_db_user
is the username you use to connect to the remote database.
./path/to/local/dumpfile
is the path to your local PostgreSQL latest.dump file. deploy@13.51.249.208:/home/deploy
3.
Make sure the remote PostgreSQL server is configured to allow connections from your IP and that you have the necessary privileges to restore the database.
Also,Load the dump file shouldinto the hatchbox database
Find the database information in the https://app.hatchbox.io/database_clusters page on Hatchbox.
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U user_6353c004a1da -d db_94eeb162733f latest.dump
This will result in some errors but these can most likely be compatibleignored withsince thethey versionare of PostgreSQL on the remote serverrelated to avoidheroku issuestables. during restoration.