Skip to content

Instantly share code, notes, and snippets.

@NathanielWroblewski
Created December 24, 2013 02:21
Show Gist options
  • Select an option

  • Save NathanielWroblewski/8107936 to your computer and use it in GitHub Desktop.

Select an option

Save NathanielWroblewski/8107936 to your computer and use it in GitHub Desktop.
Copy a production database locally
#!/bin/bash
#import the latest dump from production
heroku pgbackups:capture --expire --app <YOUR APP NAME HERE>
curl -o latest.dump `heroku pgbackups:url --app <YOUR APP NAME HERE>`
pg_restore --verbose --clean --no-acl --no-owner -h <DATABASE HOST> -U <DATABSE USERNAME> -d <DATABASE NAME> latest.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment