diff --git a/deploy_v2/pre_migration.py b/deploy_v2/pre_migration.py index 53f58d95..7501976f 100755 --- a/deploy_v2/pre_migration.py +++ b/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