Skip to content

Instantly share code, notes, and snippets.

@LordXyTh
LordXyTh / gist:cf754b86926b3926e9079f6530d3355d
Created January 25, 2023 18:22 — forked from dirkgroenen/gist:07c3e8e4bc7e08bc3232ae0bdd6a0ba5
Backup Heroku Postgres database and restore to local database

Grab new backup of database

Command: heroku pgbackups:capture --remote production

Response: >>> HEROKU_POSTGRESQL_COLOR_URL (DATABASE_URL) ----backup---> a712

Get url of backup download

Command: heroku pgbackups:url [db_key] --remote production

@LordXyTh
LordXyTh / db_synch.sh
Last active March 17, 2023 16:48
Shell Script to download a remote database, flush local database, or restore from dump for django
#!/bin/bash
# TODO: Check if file exists
# ------------------------------------------------------------------------------
# Environment Variables
export HOST=
export USERNAME=
export DB_NAME=