Skip to content

Instantly share code, notes, and snippets.

@michrome
Last active December 27, 2015 14:09
Show Gist options
  • Save michrome/7338334 to your computer and use it in GitHub Desktop.
Save michrome/7338334 to your computer and use it in GitHub Desktop.
Capture a Postgres backup from Heroku and restore it to a local development database
#!/bin/bash
# Capture a backup
heroku pgbackups:capture
# Download the backup
curl -o latest.dump `heroku pgbackups:url`
# Restore the back locally
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U `whoami` -d `echo ${PWD##*/}_development` latest.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment