Fix migrací vE (= aby fungovalo unapply alespoň na prázdné databázy)

This commit is contained in:
Jonas Havelka 2020-09-06 11:56:20 +02:00
parent b930afbda9
commit 41a027a941
10 changed files with 31 additions and 17 deletions

View file

@ -877,6 +877,7 @@ class Migration(migrations.Migration):
), ),
migrations.RunSQL( migrations.RunSQL(
sql='update seminar_rocniky set rocnik_n = cast (rocnik as integer)', sql='update seminar_rocniky set rocnik_n = cast (rocnik as integer)',
reverse_sql='update seminar_rocniky set rocnik_n = cast (rocnik as nvarchar(16))',
), ),
migrations.RemoveField( migrations.RemoveField(
model_name='rocnik', model_name='rocnik',
@ -1733,15 +1734,19 @@ class Migration(migrations.Migration):
# migr 0052 # migr 0052
migrations.RunPython( migrations.RunPython(
spoj_k_organizatorum_osoby, spoj_k_organizatorum_osoby,
reverse_code=migrations.RunPython.noop,
), ),
migrations.RunPython( migrations.RunPython(
fix_problem, fix_problem,
reverse_code=migrations.RunPython.noop,
), ),
migrations.RunPython( migrations.RunPython(
fix_pohadka, fix_pohadka,
reverse_code=migrations.RunPython.noop,
), ),
migrations.RunPython( migrations.RunPython(
fix_novinka, fix_novinka,
reverse_code=migrations.RunPython.noop,
), ),
# migr 0053 # migr 0053
@ -1795,25 +1800,31 @@ class Migration(migrations.Migration):
# migr 0056 # migr 0056
migrations.RunPython( migrations.RunPython(
generuj_RocnikNody_a_CisloNody, generuj_RocnikNody_a_CisloNody,
reverse_code=migrations.RunPython.noop,
), ),
# migr 0057 # migr 0057
migrations.RunPython( migrations.RunPython(
reseni_to_Reseni, reseni_to_Reseni,
reverse_code=migrations.RunPython.noop,
), ),
# migr 0058 # migr 0058
migrations.RunPython( migrations.RunPython(
uloha_to_Uloha, uloha_to_Uloha,
reverse_code=migrations.RunPython.noop,
), ),
migrations.RunPython( migrations.RunPython(
tema_to_Tema, tema_to_Tema,
reverse_code=migrations.RunPython.noop,
), ),
migrations.RunPython( migrations.RunPython(
clanek_to_Clanek, clanek_to_Clanek,
reverse_code=migrations.RunPython.noop,
), ),
migrations.RunPython( migrations.RunPython(
konfery_rucne, konfery_rucne,
reverse_code=migrations.RunPython.noop,
), ),
# migr "fix 0058" # migr "fix 0058"
@ -1825,11 +1836,13 @@ class Migration(migrations.Migration):
# migr 0059 # migr 0059
migrations.RunPython( migrations.RunPython(
vytvor_pohadkanode, vytvor_pohadkanode,
reverse_code=migrations.RunPython.noop,
), ),
# migr 0060 # migr 0060
migrations.RunPython( migrations.RunPython(
pokacej_les, pokacej_les,
reverse_code=migrations.RunPython.noop,
), ),
migrations.RemoveField( migrations.RemoveField(

View file

@ -18,7 +18,8 @@ class Migration(migrations.Migration):
preserve_default=False, preserve_default=False,
), ),
migrations.RunSQL( migrations.RunSQL(
sql="update seminar_rocniky set rocnik_n = cast (rocnik as integer)" sql="update seminar_rocniky set rocnik_n = cast (rocnik as integer)",
reverse_sql='update seminar_rocniky set rocnik_n = cast (rocnik as nvarchar(16))',
), ),
migrations.RemoveField( migrations.RemoveField(
model_name='rocnik', model_name='rocnik',

View file

@ -75,8 +75,8 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(spoj_k_organizatorum_osoby), migrations.RunPython(spoj_k_organizatorum_osoby, migrations.RunPython.noop),
migrations.RunPython(fix_problem), migrations.RunPython(fix_problem, migrations.RunPython.noop),
migrations.RunPython(fix_pohadka), migrations.RunPython(fix_pohadka, migrations.RunPython.noop),
migrations.RunPython(fix_novinka), migrations.RunPython(fix_novinka, migrations.RunPython.noop),
] ]

View file

@ -43,5 +43,5 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(generuj_RocnikNody_a_CisloNody), migrations.RunPython(generuj_RocnikNody_a_CisloNody, migrations.RunPython.noop),
] ]

View file

@ -30,5 +30,5 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(reseni_to_Reseni) migrations.RunPython(reseni_to_Reseni, migrations.RunPython.noop)
] ]

View file

@ -154,8 +154,8 @@ class Migration(migrations.Migration):
operations = [ operations = [
# ashes to Ashes, dust to Dust.... # ashes to Ashes, dust to Dust....
migrations.RunPython(uloha_to_Uloha), migrations.RunPython(uloha_to_Uloha, migrations.RunPython.noop),
migrations.RunPython(tema_to_Tema), migrations.RunPython(tema_to_Tema, migrations.RunPython.noop),
migrations.RunPython(clanek_to_Clanek), migrations.RunPython(clanek_to_Clanek, migrations.RunPython.noop),
migrations.RunPython(konfery_rucne), migrations.RunPython(konfery_rucne, migrations.RunPython.noop),
] ]

View file

@ -25,5 +25,5 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(vytvor_pohadkanode), migrations.RunPython(vytvor_pohadkanode, migrations.RunPython.noop),
] ]

View file

@ -108,5 +108,5 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(pokacej_les), migrations.RunPython(pokacej_les, migrations.RunPython.noop),
] ]

View file

@ -103,5 +103,5 @@ class Migration(migrations.Migration):
name='nazev', name='nazev',
field=models.TextField(help_text='Tento název se zobrazuje v nabídkách pro výběr vhodného TreeNode', null=True, verbose_name='název tohoto node'), field=models.TextField(help_text='Tento název se zobrazuje v nabídkách pro výběr vhodného TreeNode', null=True, verbose_name='název tohoto node'),
), ),
migrations.RunPython(fix_all_names), migrations.RunPython(fix_all_names, migrations.RunPython.noop),
] ]

View file

@ -65,6 +65,9 @@ class Migration(migrations.Migration):
model_name='reseni', model_name='reseni',
name='text_zkraceny', name='text_zkraceny',
), ),
migrations.DeleteModel( # nejdříve musím smazat objekt ukazující na konferu,
name='KonferaNode', # pak až změnit klíč konferám (viz další operace)
),
migrations.AddField( migrations.AddField(
model_name='konfera', model_name='konfera',
name='problem_ptr', name='problem_ptr',
@ -95,9 +98,6 @@ class Migration(migrations.Migration):
migrations.DeleteModel( migrations.DeleteModel(
name='ClanekNode', name='ClanekNode',
), ),
migrations.DeleteModel(
name='KonferaNode',
),
migrations.CreateModel( migrations.CreateModel(
name='Konfery_Ucastnici', name='Konfery_Ucastnici',
fields=[ fields=[