From 472b438c1c6b3ed62eb5a3f02f9b0cadf15cdebf Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Tue, 20 Jan 2026 12:32:41 -0800 Subject: [PATCH] Cleanup poor Django ordering and add the newest migration/field back --- src/documents/migrations/0001_initial.py | 698 +++++++++--------- .../migrations/0003_workflowaction_order.py | 18 + 2 files changed, 365 insertions(+), 351 deletions(-) create mode 100644 src/documents/migrations/0003_workflowaction_order.py diff --git a/src/documents/migrations/0001_initial.py b/src/documents/migrations/0001_initial.py index e1e0cf3ba..d68a5934b 100644 --- a/src/documents/migrations/0001_initial.py +++ b/src/documents/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.2.9 on 2026-01-20 18:46 +# Generated by Django 5.2.7 on 2026-01-15 22:08 import datetime @@ -249,6 +249,321 @@ class Migration(migrations.Migration): ], }, ), + migrations.CreateModel( + name="DocumentType", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=128, verbose_name="name")), + ( + "match", + models.CharField(blank=True, max_length=256, verbose_name="match"), + ), + ( + "matching_algorithm", + models.PositiveIntegerField( + choices=[ + (0, "None"), + (1, "Any word"), + (2, "All words"), + (3, "Exact match"), + (4, "Regular expression"), + (5, "Fuzzy word"), + (6, "Automatic"), + ], + default=1, + verbose_name="matching algorithm", + ), + ), + ( + "is_insensitive", + models.BooleanField(default=True, verbose_name="is insensitive"), + ), + ( + "owner", + models.ForeignKey( + blank=True, + default=None, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to=settings.AUTH_USER_MODEL, + verbose_name="owner", + ), + ), + ], + options={ + "verbose_name": "document type", + "verbose_name_plural": "document types", + "ordering": ("name",), + "abstract": False, + }, + ), + migrations.CreateModel( + name="StoragePath", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("name", models.CharField(max_length=128, verbose_name="name")), + ( + "match", + models.CharField(blank=True, max_length=256, verbose_name="match"), + ), + ( + "matching_algorithm", + models.PositiveIntegerField( + choices=[ + (0, "None"), + (1, "Any word"), + (2, "All words"), + (3, "Exact match"), + (4, "Regular expression"), + (5, "Fuzzy word"), + (6, "Automatic"), + ], + default=1, + verbose_name="matching algorithm", + ), + ), + ( + "is_insensitive", + models.BooleanField(default=True, verbose_name="is insensitive"), + ), + ("path", models.TextField(verbose_name="path")), + ( + "owner", + models.ForeignKey( + blank=True, + default=None, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to=settings.AUTH_USER_MODEL, + verbose_name="owner", + ), + ), + ], + options={ + "verbose_name": "storage path", + "verbose_name_plural": "storage paths", + "ordering": ("name",), + "abstract": False, + }, + ), + migrations.CreateModel( + name="Tag", + fields=[ + ( + "id", + models.AutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "tn_ancestors_pks", + models.TextField( + blank=True, + default="", + editable=False, + verbose_name="Ancestors pks", + ), + ), + ( + "tn_ancestors_count", + models.PositiveIntegerField( + default=0, + editable=False, + verbose_name="Ancestors count", + ), + ), + ( + "tn_children_pks", + models.TextField( + blank=True, + default="", + editable=False, + verbose_name="Children pks", + ), + ), + ( + "tn_children_count", + models.PositiveIntegerField( + default=0, + editable=False, + verbose_name="Children count", + ), + ), + ( + "tn_depth", + models.PositiveIntegerField( + default=0, + editable=False, + validators=[ + django.core.validators.MinValueValidator(0), + django.core.validators.MaxValueValidator(10), + ], + verbose_name="Depth", + ), + ), + ( + "tn_descendants_pks", + models.TextField( + blank=True, + default="", + editable=False, + verbose_name="Descendants pks", + ), + ), + ( + "tn_descendants_count", + models.PositiveIntegerField( + default=0, + editable=False, + verbose_name="Descendants count", + ), + ), + ( + "tn_index", + models.PositiveIntegerField( + default=0, + editable=False, + verbose_name="Index", + ), + ), + ( + "tn_level", + models.PositiveIntegerField( + default=1, + editable=False, + validators=[ + django.core.validators.MinValueValidator(1), + django.core.validators.MaxValueValidator(10), + ], + verbose_name="Level", + ), + ), + ( + "tn_priority", + models.PositiveIntegerField( + default=0, + validators=[ + django.core.validators.MinValueValidator(0), + django.core.validators.MaxValueValidator(9999999999), + ], + verbose_name="Priority", + ), + ), + ( + "tn_order", + models.PositiveIntegerField( + default=0, + editable=False, + verbose_name="Order", + ), + ), + ( + "tn_siblings_pks", + models.TextField( + blank=True, + default="", + editable=False, + verbose_name="Siblings pks", + ), + ), + ( + "tn_siblings_count", + models.PositiveIntegerField( + default=0, + editable=False, + verbose_name="Siblings count", + ), + ), + ("name", models.CharField(max_length=128, verbose_name="name")), + ( + "match", + models.CharField(blank=True, max_length=256, verbose_name="match"), + ), + ( + "matching_algorithm", + models.PositiveIntegerField( + choices=[ + (0, "None"), + (1, "Any word"), + (2, "All words"), + (3, "Exact match"), + (4, "Regular expression"), + (5, "Fuzzy word"), + (6, "Automatic"), + ], + default=1, + verbose_name="matching algorithm", + ), + ), + ( + "is_insensitive", + models.BooleanField(default=True, verbose_name="is insensitive"), + ), + ( + "color", + models.CharField( + default="#a6cee3", + max_length=7, + verbose_name="color", + ), + ), + ( + "is_inbox_tag", + models.BooleanField( + default=False, + help_text="Marks this tag as an inbox tag: All newly consumed documents will be tagged with inbox tags.", + verbose_name="is inbox tag", + ), + ), + ( + "owner", + models.ForeignKey( + blank=True, + default=None, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + to=settings.AUTH_USER_MODEL, + verbose_name="owner", + ), + ), + ( + "tn_parent", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + related_name="tn_children", + to="documents.tag", + verbose_name="Parent", + ), + ), + ], + options={ + "verbose_name": "tag", + "verbose_name_plural": "tags", + "ordering": ("name",), + "abstract": False, + }, + ), migrations.CreateModel( name="Document", fields=[ @@ -429,6 +744,37 @@ class Migration(migrations.Migration): verbose_name="owner", ), ), + ( + "document_type", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="documents", + to="documents.documenttype", + verbose_name="document type", + ), + ), + ( + "storage_path", + models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, + related_name="documents", + to="documents.storagepath", + verbose_name="storage path", + ), + ), + ( + "tags", + models.ManyToManyField( + blank=True, + related_name="documents", + to="documents.tag", + verbose_name="tags", + ), + ), ], options={ "verbose_name": "document", @@ -534,74 +880,6 @@ class Migration(migrations.Migration): "ordering": ("created",), }, ), - migrations.CreateModel( - name="DocumentType", - fields=[ - ( - "id", - models.AutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("name", models.CharField(max_length=128, verbose_name="name")), - ( - "match", - models.CharField(blank=True, max_length=256, verbose_name="match"), - ), - ( - "matching_algorithm", - models.PositiveIntegerField( - choices=[ - (0, "None"), - (1, "Any word"), - (2, "All words"), - (3, "Exact match"), - (4, "Regular expression"), - (5, "Fuzzy word"), - (6, "Automatic"), - ], - default=1, - verbose_name="matching algorithm", - ), - ), - ( - "is_insensitive", - models.BooleanField(default=True, verbose_name="is insensitive"), - ), - ( - "owner", - models.ForeignKey( - blank=True, - default=None, - null=True, - on_delete=django.db.models.deletion.SET_NULL, - to=settings.AUTH_USER_MODEL, - verbose_name="owner", - ), - ), - ], - options={ - "verbose_name": "document type", - "verbose_name_plural": "document types", - "ordering": ("name",), - "abstract": False, - }, - ), - migrations.AddField( - model_name="document", - name="document_type", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.SET_NULL, - related_name="documents", - to="documents.documenttype", - verbose_name="document type", - ), - ), migrations.CreateModel( name="Note", fields=[ @@ -1054,287 +1332,6 @@ class Migration(migrations.Migration): "ordering": ("created",), }, ), - migrations.CreateModel( - name="StoragePath", - fields=[ - ( - "id", - models.AutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("name", models.CharField(max_length=128, verbose_name="name")), - ( - "match", - models.CharField(blank=True, max_length=256, verbose_name="match"), - ), - ( - "matching_algorithm", - models.PositiveIntegerField( - choices=[ - (0, "None"), - (1, "Any word"), - (2, "All words"), - (3, "Exact match"), - (4, "Regular expression"), - (5, "Fuzzy word"), - (6, "Automatic"), - ], - default=1, - verbose_name="matching algorithm", - ), - ), - ( - "is_insensitive", - models.BooleanField(default=True, verbose_name="is insensitive"), - ), - ("path", models.TextField(verbose_name="path")), - ( - "owner", - models.ForeignKey( - blank=True, - default=None, - null=True, - on_delete=django.db.models.deletion.SET_NULL, - to=settings.AUTH_USER_MODEL, - verbose_name="owner", - ), - ), - ], - options={ - "verbose_name": "storage path", - "verbose_name_plural": "storage paths", - "ordering": ("name",), - "abstract": False, - }, - ), - migrations.AddField( - model_name="document", - name="storage_path", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.SET_NULL, - related_name="documents", - to="documents.storagepath", - verbose_name="storage path", - ), - ), - migrations.CreateModel( - name="Tag", - fields=[ - ( - "id", - models.AutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ( - "tn_ancestors_pks", - models.TextField( - blank=True, - default="", - editable=False, - verbose_name="Ancestors pks", - ), - ), - ( - "tn_ancestors_count", - models.PositiveIntegerField( - default=0, - editable=False, - verbose_name="Ancestors count", - ), - ), - ( - "tn_children_pks", - models.TextField( - blank=True, - default="", - editable=False, - verbose_name="Children pks", - ), - ), - ( - "tn_children_count", - models.PositiveIntegerField( - default=0, - editable=False, - verbose_name="Children count", - ), - ), - ( - "tn_depth", - models.PositiveIntegerField( - default=0, - editable=False, - validators=[ - django.core.validators.MinValueValidator(0), - django.core.validators.MaxValueValidator(10), - ], - verbose_name="Depth", - ), - ), - ( - "tn_descendants_pks", - models.TextField( - blank=True, - default="", - editable=False, - verbose_name="Descendants pks", - ), - ), - ( - "tn_descendants_count", - models.PositiveIntegerField( - default=0, - editable=False, - verbose_name="Descendants count", - ), - ), - ( - "tn_index", - models.PositiveIntegerField( - default=0, - editable=False, - verbose_name="Index", - ), - ), - ( - "tn_level", - models.PositiveIntegerField( - default=1, - editable=False, - validators=[ - django.core.validators.MinValueValidator(1), - django.core.validators.MaxValueValidator(10), - ], - verbose_name="Level", - ), - ), - ( - "tn_priority", - models.PositiveIntegerField( - default=0, - validators=[ - django.core.validators.MinValueValidator(0), - django.core.validators.MaxValueValidator(9999999999), - ], - verbose_name="Priority", - ), - ), - ( - "tn_order", - models.PositiveIntegerField( - default=0, - editable=False, - verbose_name="Order", - ), - ), - ( - "tn_siblings_pks", - models.TextField( - blank=True, - default="", - editable=False, - verbose_name="Siblings pks", - ), - ), - ( - "tn_siblings_count", - models.PositiveIntegerField( - default=0, - editable=False, - verbose_name="Siblings count", - ), - ), - ("name", models.CharField(max_length=128, verbose_name="name")), - ( - "match", - models.CharField(blank=True, max_length=256, verbose_name="match"), - ), - ( - "matching_algorithm", - models.PositiveIntegerField( - choices=[ - (0, "None"), - (1, "Any word"), - (2, "All words"), - (3, "Exact match"), - (4, "Regular expression"), - (5, "Fuzzy word"), - (6, "Automatic"), - ], - default=1, - verbose_name="matching algorithm", - ), - ), - ( - "is_insensitive", - models.BooleanField(default=True, verbose_name="is insensitive"), - ), - ( - "color", - models.CharField( - default="#a6cee3", - max_length=7, - verbose_name="color", - ), - ), - ( - "is_inbox_tag", - models.BooleanField( - default=False, - help_text="Marks this tag as an inbox tag: All newly consumed documents will be tagged with inbox tags.", - verbose_name="is inbox tag", - ), - ), - ( - "owner", - models.ForeignKey( - blank=True, - default=None, - null=True, - on_delete=django.db.models.deletion.SET_NULL, - to=settings.AUTH_USER_MODEL, - verbose_name="owner", - ), - ), - ( - "tn_parent", - models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.CASCADE, - related_name="tn_children", - to="documents.tag", - verbose_name="Parent", - ), - ), - ], - options={ - "verbose_name": "tag", - "verbose_name_plural": "tags", - "ordering": ("name",), - "abstract": False, - }, - ), - migrations.AddField( - model_name="document", - name="tags", - field=models.ManyToManyField( - blank=True, - related_name="documents", - to="documents.tag", - verbose_name="tags", - ), - ), migrations.CreateModel( name="UiSettings", fields=[ @@ -1383,7 +1380,6 @@ class Migration(migrations.Migration): verbose_name="Workflow Action Type", ), ), - ("order", models.PositiveIntegerField(default=0, verbose_name="order")), ( "assign_title", models.TextField( diff --git a/src/documents/migrations/0003_workflowaction_order.py b/src/documents/migrations/0003_workflowaction_order.py new file mode 100644 index 000000000..82bc49ba7 --- /dev/null +++ b/src/documents/migrations/0003_workflowaction_order.py @@ -0,0 +1,18 @@ +# Generated by Django 5.2.9 on 2026-01-20 20:06 + +from django.db import migrations +from django.db import models + + +class Migration(migrations.Migration): + dependencies = [ + ("documents", "0002_initial"), + ] + + operations = [ + migrations.AddField( + model_name="workflowaction", + name="order", + field=models.PositiveIntegerField(default=0, verbose_name="order"), + ), + ]