From f76dd86f73e03b81e19a6ad5f9a62d332b451b58 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sun, 22 Aug 2021 13:34:34 +0200 Subject: [PATCH] fix migration chain --- cookbook/migrations/0141_keyword_to_tree.py | 70 ------------------- ...index.py => 0143_build_full_text_index.py} | 2 +- ...hfields.py => 0144_create_searchfields.py} | 2 +- ...0145_alter_userpreference_search_style.py} | 2 +- ...146_alter_userpreference_use_fractions.py} | 2 +- ...ord_to_tree.py => 0147_keyword_to_tree.py} | 2 +- ...813_1829.py => 0148_auto_20210813_1829.py} | 2 +- ...py => 0149_fix_leading_trailing_spaces.py} | 2 +- 8 files changed, 7 insertions(+), 77 deletions(-) delete mode 100644 cookbook/migrations/0141_keyword_to_tree.py rename cookbook/migrations/{0142_build_full_text_index.py => 0143_build_full_text_index.py} (98%) rename cookbook/migrations/{0143_create_searchfields.py => 0144_create_searchfields.py} (92%) rename cookbook/migrations/{0144_alter_userpreference_search_style.py => 0145_alter_userpreference_search_style.py} (89%) rename cookbook/migrations/{0145_alter_userpreference_use_fractions.py => 0146_alter_userpreference_use_fractions.py} (84%) rename cookbook/migrations/{0146_keyword_to_tree.py => 0147_keyword_to_tree.py} (97%) rename cookbook/migrations/{0147_auto_20210813_1829.py => 0148_auto_20210813_1829.py} (97%) rename cookbook/migrations/{0148_fix_leading_trailing_spaces.py => 0149_fix_leading_trailing_spaces.py} (94%) diff --git a/cookbook/migrations/0141_keyword_to_tree.py b/cookbook/migrations/0141_keyword_to_tree.py deleted file mode 100644 index f4337a6a..00000000 --- a/cookbook/migrations/0141_keyword_to_tree.py +++ /dev/null @@ -1,70 +0,0 @@ -# Generated by Django 3.1.7 on 2021-03-30 19:42 - -from treebeard.mp_tree import MP_Node -from django.db import migrations, models -from django_scopes import scopes_disabled -# update if needed -steplen = MP_Node.steplen -alphabet = MP_Node.alphabet -node_order_by = ["name"] - - -def update_paths(apps, schema_editor): - with scopes_disabled(): - Node = apps.get_model("cookbook", "Keyword") - nodes = Node.objects.all().order_by(*node_order_by) - for i, node in enumerate(nodes, 1): - # for default values, this resolves to: "{:04d}".format(i) - node.path = f"{{:{alphabet[0]}{steplen}d}}".format(i) - if nodes: - Node.objects.bulk_update(nodes, ["path"]) - - -def backwards(apps, schema_editor): - """nothing to do""" - - -class Migration(migrations.Migration): - - dependencies = [ - ('cookbook', '0140_userpreference_created_at'), - ] - - operations = [ - migrations.AddField( - model_name='keyword', - name='depth', - field=models.PositiveIntegerField(default=1), - preserve_default=False, - ), - migrations.AddField( - model_name='keyword', - name='numchild', - field=models.PositiveIntegerField(default=0), - ), - migrations.AddField( - model_name='keyword', - name='path', - field=models.CharField(default="", max_length=255, unique=False), - preserve_default=False, - ), - migrations.AlterField( - model_name='userpreference', - name='use_fractions', - field=models.BooleanField(default=True), - ), - migrations.RunPython(update_paths, backwards), - migrations.AlterField( - model_name="keyword", - name="path", - field=models.CharField(max_length=255, unique=True), - ), - migrations.AlterUniqueTogether( - name='keyword', - unique_together=set(), - ), - migrations.AddConstraint( - model_name='keyword', - constraint=models.UniqueConstraint(fields=('space', 'name'), name='unique_name_per_space'), - ), - ] diff --git a/cookbook/migrations/0142_build_full_text_index.py b/cookbook/migrations/0143_build_full_text_index.py similarity index 98% rename from cookbook/migrations/0142_build_full_text_index.py rename to cookbook/migrations/0143_build_full_text_index.py index fd0d25a9..ca58fb0e 100644 --- a/cookbook/migrations/0142_build_full_text_index.py +++ b/cookbook/migrations/0143_build_full_text_index.py @@ -27,7 +27,7 @@ def set_default_search_vector(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('cookbook', '0141_auto_20210713_1042'), + ('cookbook', '0142_alter_userpreference_search_style'), ] operations = [ migrations.AddField( diff --git a/cookbook/migrations/0143_create_searchfields.py b/cookbook/migrations/0144_create_searchfields.py similarity index 92% rename from cookbook/migrations/0143_create_searchfields.py rename to cookbook/migrations/0144_create_searchfields.py index 79fb986a..dfbb486c 100644 --- a/cookbook/migrations/0143_create_searchfields.py +++ b/cookbook/migrations/0144_create_searchfields.py @@ -13,7 +13,7 @@ def create_searchfields(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('cookbook', '0142_build_full_text_index'), + ('cookbook', '0143_build_full_text_index'), ] operations = [ diff --git a/cookbook/migrations/0144_alter_userpreference_search_style.py b/cookbook/migrations/0145_alter_userpreference_search_style.py similarity index 89% rename from cookbook/migrations/0144_alter_userpreference_search_style.py rename to cookbook/migrations/0145_alter_userpreference_search_style.py index 6a9417ab..afcae5c1 100644 --- a/cookbook/migrations/0144_alter_userpreference_search_style.py +++ b/cookbook/migrations/0145_alter_userpreference_search_style.py @@ -6,7 +6,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('cookbook', '0143_create_searchfields'), + ('cookbook', '0144_create_searchfields'), ] operations = [ diff --git a/cookbook/migrations/0145_alter_userpreference_use_fractions.py b/cookbook/migrations/0146_alter_userpreference_use_fractions.py similarity index 84% rename from cookbook/migrations/0145_alter_userpreference_use_fractions.py rename to cookbook/migrations/0146_alter_userpreference_use_fractions.py index 0fa55fb4..e913f893 100644 --- a/cookbook/migrations/0145_alter_userpreference_use_fractions.py +++ b/cookbook/migrations/0146_alter_userpreference_use_fractions.py @@ -6,7 +6,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('cookbook', '0144_alter_userpreference_search_style'), + ('cookbook', '0145_alter_userpreference_search_style'), ] operations = [ diff --git a/cookbook/migrations/0146_keyword_to_tree.py b/cookbook/migrations/0147_keyword_to_tree.py similarity index 97% rename from cookbook/migrations/0146_keyword_to_tree.py rename to cookbook/migrations/0147_keyword_to_tree.py index 93674e5a..32967b5e 100644 --- a/cookbook/migrations/0146_keyword_to_tree.py +++ b/cookbook/migrations/0147_keyword_to_tree.py @@ -27,7 +27,7 @@ def backwards(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('cookbook', '0145_alter_userpreference_use_fractions'), + ('cookbook', '0146_alter_userpreference_use_fractions'), ] operations = [ diff --git a/cookbook/migrations/0147_auto_20210813_1829.py b/cookbook/migrations/0148_auto_20210813_1829.py similarity index 97% rename from cookbook/migrations/0147_auto_20210813_1829.py rename to cookbook/migrations/0148_auto_20210813_1829.py index 3d8ee977..ed6758d9 100644 --- a/cookbook/migrations/0147_auto_20210813_1829.py +++ b/cookbook/migrations/0148_auto_20210813_1829.py @@ -6,7 +6,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('cookbook', '0146_keyword_to_tree'), + ('cookbook', '0147_keyword_to_tree'), ] operations = [ diff --git a/cookbook/migrations/0148_fix_leading_trailing_spaces.py b/cookbook/migrations/0149_fix_leading_trailing_spaces.py similarity index 94% rename from cookbook/migrations/0148_fix_leading_trailing_spaces.py rename to cookbook/migrations/0149_fix_leading_trailing_spaces.py index 6d07f3ed..779de652 100644 --- a/cookbook/migrations/0148_fix_leading_trailing_spaces.py +++ b/cookbook/migrations/0149_fix_leading_trailing_spaces.py @@ -23,7 +23,7 @@ def backwards(apps, schema_editor): class Migration(migrations.Migration): dependencies = [ - ('cookbook', '0147_auto_20210813_1829'), + ('cookbook', '0148_auto_20210813_1829'), ] operations = [