From b26a603e2f98475adddb09b08cd217bb13506de5 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Wed, 30 Aug 2023 14:49:56 +0200 Subject: [PATCH] Update documentation on importing a database --- docs/clean-up-prod-db-for-import.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/clean-up-prod-db-for-import.md b/docs/clean-up-prod-db-for-import.md index d7cebaf4..900769be 100644 --- a/docs/clean-up-prod-db-for-import.md +++ b/docs/clean-up-prod-db-for-import.md @@ -1,4 +1,18 @@ +Download latest backup from Heroku + +``` +heroku pg:backups:download --app appname +``` + +Load backup locally + +``` +# assumes your POSTGRES env variables are set correctly +./bin/restore-database.sh -f -d +``` + Remove all users that are not admin users, also their created contents + ``` Objective.objects.exclude(owner=None).delete() Comment.objects.all().delete() @@ -22,7 +36,7 @@ aws s3 cp local.dump s3://skillbox-developer-bucket/ Get a presigned url from S3 for the dump (supposedly works from the command line, I had to use the S3 web UI) ``` -aws s3 presign s3://bucket-name/dump.name +aws s3 presign s3://skillbox-developer-bucket/local.dump ``` Load backup in heroku