Skip to content

Instantly share code, notes, and snippets.

@timrogers
Created July 31, 2016 14:23
Show Gist options
  • Save timrogers/02c42be72d38b9443c5b4407af05c1d5 to your computer and use it in GitHub Desktop.
Save timrogers/02c42be72d38b9443c5b4407af05c1d5 to your computer and use it in GitHub Desktop.
herokuize, a script for seeding your local Rails environment from Heroku. Just specify $PG_USERNAME and $PG_DATABASE.
#!/bin/bash
heroku pg:backups capture
curl -o latest.dump `heroku pg:backups public-url`
bundle exec rake db:drop db:create
pg_restore --verbose --clean --no-acl --no-owner -h localhost -U $PG_USERNAME -d $PG_DATABASE latest.dump
rm latest.dump
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment