mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #27996 -- Added RandomUUID function and CryptoExtension to contrib.postgres.
This commit is contained in:
committed by
Tim Graham
parent
98ee57e343
commit
fcb5dbfec0
@@ -7,6 +7,26 @@ All of these functions are available from the
|
||||
|
||||
.. currentmodule:: django.contrib.postgres.functions
|
||||
|
||||
``RandomUUID``
|
||||
==============
|
||||
|
||||
.. class:: RandomUUID()
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
||||
Returns a version 4 UUID.
|
||||
|
||||
The `pgcrypto extension`_ must be installed. You can use the
|
||||
:class:`~django.contrib.postgres.operations.CryptoExtension` migration
|
||||
operation to install it.
|
||||
|
||||
.. _pgcrypto extension: https://www.postgresql.org/docs/current/static/pgcrypto.html
|
||||
|
||||
Usage example::
|
||||
|
||||
>>> from django.contrib.postgres.functions import RandomUUID
|
||||
>>> Article.objects.update(uuid=RandomUUID())
|
||||
|
||||
``TransactionNow``
|
||||
==================
|
||||
|
||||
|
||||
@@ -67,6 +67,15 @@ run the query ``CREATE EXTENSION IF NOT EXISTS hstore;``.
|
||||
|
||||
Installs the ``citext`` extension.
|
||||
|
||||
``CryptoExtension``
|
||||
===================
|
||||
|
||||
.. class:: CryptoExtension()
|
||||
|
||||
.. versionadded:: 2.0
|
||||
|
||||
Installs the ``pgcrypto`` extension.
|
||||
|
||||
``HStoreExtension``
|
||||
===================
|
||||
|
||||
|
||||
@@ -87,6 +87,12 @@ Minor features
|
||||
:class:`~django.contrib.postgres.aggregates.ArrayAgg` determines if
|
||||
concatenated values will be distinct.
|
||||
|
||||
* The new :class:`~django.contrib.postgres.functions.RandomUUID` database
|
||||
function returns a version 4 UUID. It requires use of PostgreSQL's
|
||||
``pgcrypto`` extension which can be activated using the new
|
||||
:class:`~django.contrib.postgres.operations.CryptoExtension` migration
|
||||
operation.
|
||||
|
||||
:mod:`django.contrib.redirects`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
Reference in New Issue
Block a user