Skip to content

Instantly share code, notes, and snippets.

@biske
Last active September 25, 2015 13:38
Show Gist options
  • Save biske/6d6be7e06fe6d0778d56 to your computer and use it in GitHub Desktop.
Save biske/6d6be7e06fe6d0778d56 to your computer and use it in GitHub Desktop.
backup and restore database from heroku to local env
$ heroku pg:backups -a tti-cedar
$ curl -o tmp/legacy-a665.dump "urlfrompreviouscommand"
Remove all conections to database (for example shut down rails servers or rails console).
# From legacy project:
$ bundle exec rake db:drop
$ bundle exec rake db:create
$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U ivanbisevac1 -d tti_development tmp/legacy-a665.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