diff options
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/releases/5.0.txt | 36 |
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 ------------- |
