From 5488530a272b863794484ee2b027294ff2ec86d2 Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Thu, 8 May 2025 16:37:11 -0400 Subject: Fixed #36377 -- Added hints support to CreateExtension and subclasses. --- docs/ref/contrib/postgres/operations.txt | 90 ++++++++++++++++++++++++++++---- docs/releases/6.0.txt | 8 +++ 2 files changed, 89 insertions(+), 9 deletions(-) (limited to 'docs') diff --git a/docs/ref/contrib/postgres/operations.txt b/docs/ref/contrib/postgres/operations.txt index 1c4cd562d1..e2b9af4f60 100644 --- a/docs/ref/contrib/postgres/operations.txt +++ b/docs/ref/contrib/postgres/operations.txt @@ -41,7 +41,7 @@ them. In that case, connect to your Django database and run the query ``CreateExtension`` =================== -.. class:: CreateExtension(name) +.. class:: CreateExtension(name, hints=None) An ``Operation`` subclass which installs a PostgreSQL extension. For common extensions, use one of the more specific subclasses below. @@ -50,63 +50,135 @@ them. In that case, connect to your Django database and run the query This is a required argument. The name of the extension to be installed. + .. attribute:: hints + + .. versionadded:: 6.0 + + The optional ``hints`` argument will be passed as ``**hints`` to the + :meth:`allow_migrate` method of database routers to assist them in + :ref:`making routing decisions `. + ``BloomExtension`` ================== -.. class:: BloomExtension() +.. class:: BloomExtension(hints=None) Installs the ``bloom`` extension. + .. attribute:: hints + + .. versionadded:: 6.0 + + The optional ``hints`` argument will be passed as ``**hints`` to the + :meth:`allow_migrate` method of database routers to assist them in + :ref:`making routing decisions `. + ``BtreeGinExtension`` ===================== -.. class:: BtreeGinExtension() +.. class:: BtreeGinExtension(hints=None) Installs the ``btree_gin`` extension. + .. attribute:: hints + + .. versionadded:: 6.0 + + The optional ``hints`` argument will be passed as ``**hints`` to the + :meth:`allow_migrate` method of database routers to assist them in + :ref:`making routing decisions `. + ``BtreeGistExtension`` ====================== -.. class:: BtreeGistExtension() +.. class:: BtreeGistExtension(hints=None) Installs the ``btree_gist`` extension. + .. attribute:: hints + + .. versionadded:: 6.0 + + The optional ``hints`` argument will be passed as ``**hints`` to the + :meth:`allow_migrate` method of database routers to assist them in + :ref:`making routing decisions `. + ``CITextExtension`` =================== -.. class:: CITextExtension() +.. class:: CITextExtension(hints=None) Installs the ``citext`` extension. + .. attribute:: hints + + .. versionadded:: 6.0 + + The optional ``hints`` argument will be passed as ``**hints`` to the + :meth:`allow_migrate` method of database routers to assist them in + :ref:`making routing decisions `. + ``CryptoExtension`` =================== -.. class:: CryptoExtension() +.. class:: CryptoExtension(hints=None) Installs the ``pgcrypto`` extension. + .. attribute:: hints + + .. versionadded:: 6.0 + + The optional ``hints`` argument will be passed as ``**hints`` to the + :meth:`allow_migrate` method of database routers to assist them in + :ref:`making routing decisions `. + ``HStoreExtension`` =================== -.. class:: HStoreExtension() +.. class:: HStoreExtension(hints=None) Installs the ``hstore`` extension and also sets up the connection to interpret hstore data for possible use in subsequent migrations. + .. attribute:: hints + + .. versionadded:: 6.0 + + The optional ``hints`` argument will be passed as ``**hints`` to the + :meth:`allow_migrate` method of database routers to assist them in + :ref:`making routing decisions `. + ``TrigramExtension`` ==================== -.. class:: TrigramExtension() +.. class:: TrigramExtension(hints=None) Installs the ``pg_trgm`` extension. + .. attribute:: hints + + .. versionadded:: 6.0 + + The optional ``hints`` argument will be passed as ``**hints`` to the + :meth:`allow_migrate` method of database routers to assist them in + :ref:`making routing decisions `. + ``UnaccentExtension`` ===================== -.. class:: UnaccentExtension() +.. class:: UnaccentExtension(hints=None) Installs the ``unaccent`` extension. + .. attribute:: hints + + .. versionadded:: 6.0 + + The optional ``hints`` argument will be passed as ``**hints`` to the + :meth:`allow_migrate` method of database routers to assist them in + :ref:`making routing decisions `. + .. _manage-postgresql-collations: Managing collations using migrations diff --git a/docs/releases/6.0.txt b/docs/releases/6.0.txt index c5fa1bac63..9d8120f5c2 100644 --- a/docs/releases/6.0.txt +++ b/docs/releases/6.0.txt @@ -135,6 +135,14 @@ Minor features now include system checks to verify that ``django.contrib.postgres`` is an installed app. +* The :class:`.CreateExtension`, :class:`.BloomExtension`, + :class:`.BtreeGinExtension`, :class:`.BtreeGistExtension`, + :class:`.CITextExtension`, :class:`.CryptoExtension`, + :class:`.HStoreExtension`, :class:`.TrigramExtension`, and + :class:`.UnaccentExtension` operations now support the optional ``hints`` + parameter. This allows providing database hints to database routers to assist + them in :ref:`making routing decisions `. + :mod:`django.contrib.redirects` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- cgit v1.3