From 3297dede7fce4b190f7b3bf0b0fc29a734151b61 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Tue, 27 Jun 2017 21:15:15 +0200 Subject: Fixed #28046 -- Added the db_tablespace parameter to class-based indexes. Thanks Markus Holtermann and Tim Graham for reviews. --- docs/ref/models/indexes.txt | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'docs/ref/models') diff --git a/docs/ref/models/indexes.txt b/docs/ref/models/indexes.txt index 1b2af670d7..6e8ab210ee 100644 --- a/docs/ref/models/indexes.txt +++ b/docs/ref/models/indexes.txt @@ -23,7 +23,7 @@ options`_. ``Index`` options ================= -.. class:: Index(fields=[], name=None) +.. class:: Index(fields=[], name=None, db_tablespace=None) Creates an index (B-Tree) in the database. @@ -57,6 +57,23 @@ The name of the index. If ``name`` isn't provided Django will auto-generate a name. For compatibility with different databases, index names cannot be longer than 30 characters and shouldn't start with a number (0-9) or underscore (_). +``db_tablespace`` +----------------- + +.. attribute:: Index.db_tablespace + +.. versionadded:: 2.0 + +The name of the :doc:`database tablespace ` to use for +this index. For single field indexes, if ``db_tablespace`` isn't provided, the +index is created in the ``db_tablespace`` of the field. + +If :attr:`.Field.db_tablespace` isn't specified (or if the index uses multiple +fields), the index is created in tablespace specified in the +:attr:`~django.db.models.Options.db_tablespace` option inside the model's +``class Meta``. If neither of those tablespaces are set, the index is created +in the same tablespace as the table. + .. seealso:: For a list of PostgreSQL-specific indexes, see -- cgit v1.3