Browse Source

Pred migraci chceme smazat uzivatele bez Organizatoru

prekazeli.
middleware_test
Pavel Turinsky (DebianVM @ Zr) 3 years ago
parent
commit
e3a5c4bbeb
  1. 11
      deploy_v2/pre_migration.py

11
deploy_v2/pre_migration.py

@ -23,5 +23,16 @@ def smaz_zle_clanky():
# Nakonec i ty clanky samotne # Nakonec i ty clanky samotne
cursor.execute('DELETE FROM seminar_problemy WHERE id IN (1981, 1970, 2222);') 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_zle_clanky()
smaz_divne_uzivatele()

Loading…
Cancel
Save