From 3a56eafa59e6e698b7be82d0d87ff4902d2e6984 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Thu, 20 Aug 2020 00:34:14 +0200 Subject: [PATCH] =?UTF-8?q?Opravn=C3=A1=20migrace,=20proto=C5=BEe=20to=20p?= =?UTF-8?q?rost=C4=9B=20nefungovalo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Kdyby to byl býval RunSQL, byl to oneliner... --- .../migrations/0059_vytvorit_pohadkanode.py | 2 +- seminar/migrations/fix_0058.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 seminar/migrations/fix_0058.py diff --git a/seminar/migrations/0059_vytvorit_pohadkanode.py b/seminar/migrations/0059_vytvorit_pohadkanode.py index 7ff7c655..d0edd677 100644 --- a/seminar/migrations/0059_vytvorit_pohadkanode.py +++ b/seminar/migrations/0059_vytvorit_pohadkanode.py @@ -21,7 +21,7 @@ def vytvor_pohadkanode(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('seminar', '0058_problem_to_uloha_tema_clanek'), + ('seminar', 'fix_0058'), ] operations = [ diff --git a/seminar/migrations/fix_0058.py b/seminar/migrations/fix_0058.py new file mode 100644 index 00000000..e344d237 --- /dev/null +++ b/seminar/migrations/fix_0058.py @@ -0,0 +1,19 @@ +from django.db import migrations + +def oprav_ulohy(apps, schema_editor): + Problem = apps.get_model('seminar', 'Pohadka') + + for p in Problem.objects.filter(typ="b'uloha'"): + p.typ = "uloha" + p.save() + +class Migration(migrations.Migration): + + dependencies = [ + ('seminar', '0058_problem_to_uloha_tema_clanek'), + ] + + operations = [ + migrations.RunPython(oprav_ulohy, oprav_ulohy), + ] +