Skip to content

Instantly share code, notes, and snippets.

@nitinhayaran
Last active January 4, 2019 11:19
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 nitinhayaran/e8fe703f79a9da4a5fe5 to your computer and use it in GitHub Desktop.
Save nitinhayaran/e8fe703f79a9da4a5fe5 to your computer and use it in GitHub Desktop.
Import heroku database
heroku pg:backups capture --app sushi
curl -o latest.dump `heroku pg:backups public-url --app sushi`
pg_restore --verbose --clean --no-acl --no-owner -j 8 [-U user_name] -d database_name latest.dump
# To copy prodcution data to staging app
heroku pg:backups restore `heroku pgbackups:url -a production-app` DATABASE -a staging-app
# Store prodcution data to staging
heroku pg:backups restore `heroku pgbackups:url -a production-app` DATABASE -a staging-app
heroku pg:backups restore b001 DATABASE_URL --app sushi
heroku pg:copy DATABASE_URL HEROKU_POSTGRESQL_PINK_URL --app sushi
@nitinhayaran
Copy link
Author

nitinhayaran commented Dec 8, 2015

dropdb database
createdb --owner=user database

psql --dbname=database
create extension cube;
create extension earthdistance;
create extension intarray;
CREATE EXTENSION IF NOT EXISTS pg_trgm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment