summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAlbert Defler <alnw@interia.eu>2022-10-19 13:20:48 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2023-08-02 14:11:04 +0200
commit7cd187a5ba58d7769039f487faeb9a5a2ff05540 (patch)
treeff502efdd96b864a1ab12ea25b9032025767e4cb /docs
parentee36c332b24247ba3790a355a13e682537258d6d (diff)
Fixed #33507 -- Used UUID data type on MariaDB 10.7+.
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Diffstat (limited to 'docs')
-rw-r--r--docs/releases/5.0.txt36
1 files changed, 36 insertions, 0 deletions
diff --git a/docs/releases/5.0.txt b/docs/releases/5.0.txt
index d2265f9045..e3cba0c02b 100644
--- a/docs/releases/5.0.txt
+++ b/docs/releases/5.0.txt
@@ -377,6 +377,10 @@ Models
* :meth:`.QuerySet.aiterator` now supports previous calls to
``prefetch_related()``.
+* On MariaDB 10.7+, ``UUIDField`` is now created as ``UUID`` column rather than
+ ``CHAR(32)`` column. See the migration guide above for more details on
+ :ref:`migrating-uuidfield`.
+
Pagination
~~~~~~~~~~
@@ -483,6 +487,38 @@ Using ``create_defaults__exact`` may now be required with ``QuerySet.update_or_c
``create_defaults`` that are used with an ``update_or_create()`` should specify
the field in the lookup with ``create_defaults__exact``.
+.. _migrating-uuidfield:
+
+Migrating existing ``UUIDField`` on MariaDB 10.7+
+-------------------------------------------------
+
+On MariaDB 10.7+, ``UUIDField`` is now created as ``UUID`` column rather than
+``CHAR(32)`` column. As a consequence, any ``UUIDField`` created in
+Django < 5.0 should be replaced with a ``UUIDField`` subclass backed by
+``CHAR(32)``::
+
+ class Char32UUIDField(models.UUIDField):
+ def db_type(self, connection):
+ return "char(32)"
+
+For example::
+
+ class MyModel(models.Model):
+ uuid = models.UUIDField(primary_key=True, default=uuid.uuid4)
+
+Should become::
+
+ class Char32UUIDField(models.UUIDField):
+ def db_type(self, connection):
+ return "char(32)"
+
+
+ class MyModel(models.Model):
+ uuid = Char32UUIDField(primary_key=True, default=uuid.uuid4)
+
+Running the :djadmin:`makemigrations` command will generate a migration
+containing a no-op ``AlterField`` operation.
+
Miscellaneous
-------------