Update backup and restore commands in Postgres.md

This commit is contained in:
Simon Larsen 2024-03-17 11:14:36 +00:00
parent 9b70dd2ce6
commit 9cf2ae4326
No known key found for this signature in database
GPG key ID: AB45983AA9C81CDE

View file

@ -37,6 +37,14 @@ Please make sure you have `pg_dump` and `pg_restore` installed on your local mac
To take a backup of the database, use the following command:
```
# Source Database
pg_dump -h localhost -p 5432 -U <source_username> -d oneuptimedb -f oneuptime.sql
```
# Source Database. This will prompt for the password
pg_dump --host=<source_port> --port=<target_port> --username=<source_username> --password --dbname=oneuptimedb --file=oneuptime.sql
```
To restore the database, use the following command:
```
# Target Database. This will prompt for the password
pg_restore --host=localhost --port=5432 --username=<target_username> --dbname=oneuptimedb --password --file=oneuptime.sql
```