From e3a5c4bbeb859e91a20ae543b87611a9fc02ae6d Mon Sep 17 00:00:00 2001 From: "Pavel Turinsky (DebianVM @ Zr)" Date: Tue, 29 Jun 2021 22:22:45 +0000 Subject: [PATCH] Pred migraci chceme smazat uzivatele bez Organizatoru prekazeli. --- deploy_v2/pre_migration.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/deploy_v2/pre_migration.py b/deploy_v2/pre_migration.py index 45af8dc8..53f58d95 100755 --- a/deploy_v2/pre_migration.py +++ b/deploy_v2/pre_migration.py @@ -23,5 +23,16 @@ def smaz_zle_clanky(): # Nakonec i ty clanky samotne cursor.execute('DELETE FROM seminar_problemy WHERE id IN (1981, 1970, 2222);') +def smaz_divne_uzivatele(): + # U techto uzivatelu neexistuje Organizator s nimi spojeny + # Takze pak delaji akorat neporadek + with connection.cursor() as cursor: + # Jeste je potreba zrusit vazby + cursor.execute('UPDATE django_comments SET user_id = NULL WHERE user_id = 34;') + cursor.execute('UPDATE seminar_problemy SET autor_id = NULL WHERE autor_id = 34;') + cursor.execute('DELETE FROM django_admin_log WHERE user_id = 34;') + cursor.execute('DELETE FROM auth_user_groups WHERE user_id = 34;') + cursor.execute('DELETE FROM auth_user WHERE id IN (34, 40, 30, 50, 54, 58, 43);') smaz_zle_clanky() +smaz_divne_uzivatele()