Browse Source

Rozbité problémy vyřešeny metodou ŽAVES

middleware_test
MaM Web user 3 years ago
parent
commit
7f93171c39
  1. 12
      deploy_v2/pre_migration.py

12
deploy_v2/pre_migration.py

@ -17,11 +17,15 @@ from django.db import connection
def smaz_zle_clanky():
# Tyhle clanky vubec nejsou clanky, bude potreba je udelat cele jinak a spravne.
#m.Problem.objects.filter(id__in=[1981, 1970, 2222]).delete()
## with connection.cursor() as cursor:
## # Nejdriv musime smazat reseni:
## cursor.execute('DELETE FROM seminar_reseni WHERE problem_id IN (1981, 1970, 2222);')
## # Nakonec i ty clanky samotne
## cursor.execute('DELETE FROM seminar_problemy WHERE id IN (1981, 1970, 2222);')
# Update: stejně je v DB bordel, tak z nich prostě jen udělám témata a všechno zhruba přežije…
with connection.cursor() as cursor:
# Nejdriv musime smazat reseni:
cursor.execute('DELETE FROM seminar_reseni WHERE problem_id IN (1981, 1970, 2222);')
# Nakonec i ty clanky samotne
cursor.execute('DELETE FROM seminar_problemy WHERE id IN (1981, 1970, 2222);')
cursor.execute("UPDATE seminar_problemy SET typ = 'tema' WHERE id IN (1981, 1970, 2222);")
def smaz_divne_uzivatele():
# U techto uzivatelu neexistuje Organizator s nimi spojeny

Loading…
Cancel
Save