Revert "Fix: handle UUIDField created under mariadb and Django 4"
This reverts commit 713333ff91a8f2cf24a377b8bfb433650ac68dce.
This commit is contained in:
parent
6e84c82a32
commit
3c80acc7d9
@ -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),
|
|
||||||
),
|
|
||||||
]
|
|
@ -134,19 +134,6 @@ class StoragePath(MatchingModel):
|
|||||||
verbose_name_plural = _("storage paths")
|
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):
|
class Document(SoftDeleteModel, ModelWithOwner):
|
||||||
STORAGE_TYPE_UNENCRYPTED = "unencrypted"
|
STORAGE_TYPE_UNENCRYPTED = "unencrypted"
|
||||||
STORAGE_TYPE_GPG = "gpg"
|
STORAGE_TYPE_GPG = "gpg"
|
||||||
@ -303,11 +290,6 @@ class Document(SoftDeleteModel, ModelWithOwner):
|
|||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
transaction_id = Char32UUIDField(
|
|
||||||
blank=True,
|
|
||||||
null=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ("-created",)
|
ordering = ("-created",)
|
||||||
verbose_name = _("document")
|
verbose_name = _("document")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user