Update some details of the migration document

This commit is contained in:
Lorenz Padberg 2023-08-31 09:33:39 +02:00
parent b3ced207cc
commit c533decd0b
1 changed files with 17 additions and 2 deletions

View File

@ -1,3 +1,13 @@
# Update prepreprod Database Contents
This document describes the process to import data from a Production database to a preprod database, whith
the removal of all users and their content that are not admin users.
Checkout the commit that is deployed on your target preprod app.
```
Download latest backup from Heroku Download latest backup from Heroku
``` ```
@ -13,12 +23,17 @@ Load backup locally
Remove all users that are not admin users, also their created contents Remove all users that are not admin users, also their created contents
```bash
pip install shell_plus --upgrade
python mangage.py migrate
python manage.py shell
``` ```
```python
Objective.objects.exclude(owner=None).delete() Objective.objects.exclude(owner=None).delete()
Comment.objects.all().delete() Comment.objects.all().delete()
Assignment.objects.exclude(owner=None).exclude(owner__username="guru").delete() Assignment.objects.exclude(owner=None).exclude(owner__username="guru").delete()
User.objects.filter(is_superuser=False).exclude(username="mia.teacher@getnada.com").delete()
User.objects.filter(is_superuser=False).delete()
``` ```
Make local dump of database Make local dump of database