mirror of
https://github.com/edcommonwealth/sqm-dashboards.git
synced 2026-03-07 21:48:16 -08:00
Create script to load heroku database into local db
This commit is contained in:
parent
221f0cb0bf
commit
a2ec6d7958
1 changed files with 20 additions and 0 deletions
20
scripts/load_local_db.sh
Executable file
20
scripts/load_local_db.sh
Executable file
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
set -eux
|
||||
|
||||
git rev-parse --show-toplevel
|
||||
|
||||
APP=$1
|
||||
TIMESTAMP=$(date +%s)
|
||||
DUMP_FILENAME=$APP.$TIMESTAMP.dump
|
||||
|
||||
## Uncomment this if you want the latest data
|
||||
# heroku pg:backups:capture
|
||||
heroku pg:backups:download --app=mciea-$APP --output=$DUMP_FILENAME
|
||||
|
||||
pg_restore --clean --no-acl --no-owner --dbname=mciea_development $DUMP_FILENAME
|
||||
|
||||
bundle exec rails db:environment:set RAILS_ENV=development
|
||||
|
||||
# clean up after ourselves; comment this out if you want to hold on to dump file
|
||||
rm $DUMP_FILENAME
|
||||
Loading…
Add table
Add a link
Reference in a new issue