From d2443a10d3cac33fb0593ad05e2f8d1988bcb11d Mon Sep 17 00:00:00 2001 From: Liam Morley Date: Wed, 1 Dec 2021 12:43:19 -0500 Subject: [PATCH] Remove/recreate database via rake before restoring database - --clean doesn't seem to work when the structure in the database we're loading doesn't match the structure of the database we have locally --- doc/steps_to_deploy_to_production.md | 1 + scripts/load_local_db.sh | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/steps_to_deploy_to_production.md b/doc/steps_to_deploy_to_production.md index ae0e2f86..4f671bbf 100644 --- a/doc/steps_to_deploy_to_production.md +++ b/doc/steps_to_deploy_to_production.md @@ -12,5 +12,6 @@ heroku pg:backups:download * Select branch to deploy(main) * Verify in the activity log that Heroku builds the deployment * Verify that the site contains the new features +* Run any one_off scripts that have been introduced for this release, as necessary * Run the db:seed script * Verify that the data represented on the different tabs matches what is expected. The items listed in the measure key should be represented on the site. diff --git a/scripts/load_local_db.sh b/scripts/load_local_db.sh index 772739ae..1b0b67eb 100755 --- a/scripts/load_local_db.sh +++ b/scripts/load_local_db.sh @@ -9,10 +9,11 @@ TIMESTAMP=$(date +%s) DUMP_FILENAME=$APP.$TIMESTAMP.dump ## Uncomment this if you want the latest data -# heroku pg:backups:capture +#heroku pg:backups:capture --app=mciea-$APP heroku pg:backups:download --app=mciea-$APP --output=$DUMP_FILENAME -pg_restore --clean --no-acl --no-owner --dbname=mciea_development $DUMP_FILENAME +bundle exec rake db:drop db:create +pg_restore --no-acl --no-owner --dbname=mciea_development $DUMP_FILENAME bundle exec rails db:environment:set RAILS_ENV=development