Skip to content

Instantly share code, notes, and snippets.

@lopezjurip
Created January 10, 2018 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lopezjurip/f24709a66c63c8916d42bde1b1510c7d to your computer and use it in GitHub Desktop.
Save lopezjurip/f24709a66c63c8916d42bde1b1510c7d to your computer and use it in GitHub Desktop.
Rails 5 - Create seed.rb file from production database in Heroku
# Download with Heroku CLI
heroku pg:backups:capture
heroku pg:backups:download
# Should create a dump file, let's name it 'latest.dump'
pg_restore --verbose --clean --no-acl --no-owner -h localhost -d MY_APP_development latest.dump
# Install 'seed_dump' gem
bundle exec rake db:seed:dump EXCLUDE=encrypted_password,reset_password_token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment