From 3c80acc7d9ca2a6d8ecf3e34c2f3846edea8851f Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sat, 26 Oct 2024 21:06:58 -0700 Subject: [PATCH] Revert "Fix: handle UUIDField created under mariadb and Django 4" This reverts commit 713333ff91a8f2cf24a377b8bfb433650ac68dce. --- .../1056_alter_document_transaction_id.py | 19 ------------------- src/documents/models.py | 18 ------------------ 2 files changed, 37 deletions(-) delete mode 100644 src/documents/migrations/1056_alter_document_transaction_id.py diff --git a/src/documents/migrations/1056_alter_document_transaction_id.py b/src/documents/migrations/1056_alter_document_transaction_id.py deleted file mode 100644 index 282dbba74..000000000 --- a/src/documents/migrations/1056_alter_document_transaction_id.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 5.1.1 on 2024-10-26 16:14 - -from django.db import migrations - -import documents.models - - -class Migration(migrations.Migration): - dependencies = [ - ("documents", "1055_alter_storagepath_path"), - ] - - operations = [ - migrations.AlterField( - model_name="document", - name="transaction_id", - field=documents.models.Char32UUIDField(blank=True, null=True), - ), - ] diff --git a/src/documents/models.py b/src/documents/models.py index 6d78aed3e..37c86305c 100644 --- a/src/documents/models.py +++ b/src/documents/models.py @@ -134,19 +134,6 @@ class StoragePath(MatchingModel): verbose_name_plural = _("storage paths") -# see https://docs.djangoproject.com/en/5.1/releases/5.0/#migrating-existing-uuidfield-on-mariadb-10-7 and -# https://github.com/san4ezy/django_softdelete/issues/45 -class Char32UUIDField(models.UUIDField): - def db_type(self, connection): - return "char(32)" - - def get_db_prep_value(self, value, connection, prepared=False): - value = super().get_db_prep_value(value, connection, prepared) - if value is not None and not isinstance(value, str): # pragma: no cover - value = value.hex - return value - - class Document(SoftDeleteModel, ModelWithOwner): STORAGE_TYPE_UNENCRYPTED = "unencrypted" STORAGE_TYPE_GPG = "gpg" @@ -303,11 +290,6 @@ class Document(SoftDeleteModel, ModelWithOwner): ), ) - transaction_id = Char32UUIDField( - blank=True, - null=True, - ) - class Meta: ordering = ("-created",) verbose_name = _("document")