August 03, 2023 - Dump your PostgreSQL DB locally

Tutorial: How to dump your PostgreSQL DB to your local computer

1. Forward the server port to your local system
fly proxy 5432 -a {postgres-app-name}
2. Use pg_dump to generate your backup
pg_dump -h localhost -U {username} {database name} > backup.sql
3. Close your port forwarding

4. Restore your local database
psql -U {username} -d {database name} < backup.sql