-
Notifications
You must be signed in to change notification settings - Fork 6
Generate developer database
Rasmus Rudling edited this page Nov 10, 2021
·
12 revisions
-
Terminal #1 - SSH into the server:
ssh [email protected]
-
Terminal #1 - Run script that creates new developer database:
./dump-database.sh
- In terminal #2 - Copy the developer database to your local computer in your current folder:
scp [email protected]:/home/ais/ais-database.sql ais-database-with-sensitive-info.sql
- Move
ais-developer-database.sql
to the AIS repo and enter its directory, then:**
vagrant up
vagrant ssh
- Log into psql as postgres user:
psql -U postgres
- Drop database:
drop database ais_dev;
- Quit psql:
\q
- Create database as user postgres:
psql -U postgres < ais-database-with-sensitive-info.sql
# remove_sensitive_info.py
from recruitment.models import *
from fair.models import *
remove_years = ['2016','2017','2018', '2019', '2020', '2021']
for year in remove_years:
recruitment_periods = RecruitmentPeriod.objects.filter(fair__year = year)
for period in recruitment_periods:
applications = RecruitmentApplication.objects.filter(recruitment_period = period)
for application in applications:
user = application.user
application.delete()
print(year, " ", period, " ", user)
comments = RecruitmentApplicationComment.objects.filter(recruitment_application=application).delete()
answers = CustomFieldAnswer.objects.filter(user=user).delete()
Run the script file
python manage.py shell < remove_sensitive_info.py
pg_dumpall -U postgres > ais-developer-database.sql
Send ais-developer-database.sql
to your developers!
-
For developers
-
API
-
For Head of Internal Systems