From accceec9493d08e19d59fa1a59f69c0fdf23bb13 Mon Sep 17 00:00:00 2001 From: Lily Acorn Date: Sat, 15 Nov 2025 16:29:12 +0000 Subject: Fixed #36735 -- Added UUID4 and UUID7 database functions. Co-authored-by: Mariusz Felisiak --- docs/ref/contrib/postgres/functions.txt | 5 +++++ docs/ref/models/database-functions.txt | 33 +++++++++++++++++++++++++++++++++ docs/releases/6.1.txt | 3 +++ 3 files changed, 41 insertions(+) (limited to 'docs') diff --git a/docs/ref/contrib/postgres/functions.txt b/docs/ref/contrib/postgres/functions.txt index 39d74917da..ba73d26f06 100644 --- a/docs/ref/contrib/postgres/functions.txt +++ b/docs/ref/contrib/postgres/functions.txt @@ -21,6 +21,11 @@ Usage example: >>> from django.contrib.postgres.functions import RandomUUID >>> Article.objects.update(uuid=RandomUUID()) +.. admonition:: Use :class:`django.db.models.functions.UUID4` instead. + + :class:`django.db.models.functions.UUID4` is a cross-database version of + this function. ``RandomUUID`` may be deprecated in the future. + ``TransactionNow`` ================== diff --git a/docs/ref/models/database-functions.txt b/docs/ref/models/database-functions.txt index 76c6362da9..cf251a758d 100644 --- a/docs/ref/models/database-functions.txt +++ b/docs/ref/models/database-functions.txt @@ -1878,6 +1878,39 @@ Usage example: .. _window-functions: +UUID functions +============== + +``UUID4`` +--------- + +.. versionadded:: 6.1 + +.. class:: UUID4() + +Generates a :rfc:`version 4 UUID <9562#section-5.4>`, which is random and is +generated using a cryptographically secure method. + +.. admonition:: Availability + + Available on PostgreSQL, SQLite, MariaDB version 11.7 or later, and Oracle + 23ai/26ai (23.9) or later. + +``UUID7`` +--------- + +.. versionadded:: 6.1 + +.. class:: UUID7() + +Generates a :rfc:`version 7 UUID <9562#section-5.7>`, which starts with a +time-based component. + +.. admonition:: Availability + + Available on PostgreSQL version 18 or later, MariaDB version 11.7 or later, + and SQLite on Python version 3.14 or later. + Window functions ================ diff --git a/docs/releases/6.1.txt b/docs/releases/6.1.txt index 587fec10b3..8ab9ef46a8 100644 --- a/docs/releases/6.1.txt +++ b/docs/releases/6.1.txt @@ -263,6 +263,9 @@ Models :ref:`negative array indexing ` on Oracle 21c+. +* The new :class:`~django.db.models.functions.UUID4` and + :class:`~django.db.models.functions.UUID7` database functions were added. + Pagination ~~~~~~~~~~ -- cgit v1.3