Skip to main content

Sync local sql dump to Hatchbox database

Piping through

You can use pg_restore and pipe its output directly to the psql command that connects to the remote PostgreSQL database.

  1. Command syntax:

     pg_restore /path/to/local/dumpfile | psql "host=remote_server port=5432 dbname=remote_db_name user=remote_db_user"

    Replace the placeholders with your specific details.

This methods assume that:

  • The remote PostgreSQL port is 5432 (replace as needed).
  • remote_db_name is the name of the remote database you want to restore into.
  • 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 dump file.

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, the dump file should be compatible with the version of PostgreSQL on the remote server to avoid issues during restoration.