Skip to content

Instantly share code, notes, and snippets.

@anthonycintron
Forked from biske/restore-database.txt
Created November 26, 2015 17:02
Show Gist options
  • Save anthonycintron/f10fb0c26dc95dc5ad3c to your computer and use it in GitHub Desktop.
Save anthonycintron/f10fb0c26dc95dc5ad3c 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