Skip to content

Instantly share code, notes, and snippets.

@biske
Last active November 26, 2015 17:02
Show Gist options
  • Save biske/d5d2fce8bac22f1a1fb2 to your computer and use it in GitHub Desktop.
Save biske/d5d2fce8bac22f1a1fb2 to your computer and use it in GitHub Desktop.
Restore database from Heroku to local environment
$ wget $(heroku pg:backups public-url -a legacy-next-staging) -O tmp/tti_legacy.dump
Remove all conections to database (for example shut down rails servers or rails console).
# From legacy project:
$ bundle exec rake db:drop db:create
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U ivanbisevac1 -d tti_development tmp/tti_legacy.dump
$ bundle exec rake db:migrate
# On roundabout project:
$ bin/rake db:schema:dump
$ RAILS_ENV=test bin/rake db:schema:load
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment