Refs #27236 -- Removed Meta.index_together per deprecation timeline.

This commit is contained in:
Mariusz Felisiak 2023-09-12 05:56:16 +02:00
parent 00e1879610
commit 2abf417c81
25 changed files with 41 additions and 1308 deletions

View file

@ -345,21 +345,23 @@ Models
``<field name>`` from model ``<model>``.
* **models.E007**: Field ``<field name>`` has column name ``<column name>``
that is used by another field.
* **models.E008**: ``index_together`` must be a list or tuple.
* **models.E008**: ``index_together`` must be a list or tuple. *This check
appeared before Django 5.1.*
* **models.E009**: All ``index_together`` elements must be lists or tuples.
*This check appeared before Django 5.1.*
* **models.E010**: ``unique_together`` must be a list or tuple.
* **models.E011**: All ``unique_together`` elements must be lists or tuples.
* **models.E012**: ``constraints/indexes/index_together/unique_together``
refers to the nonexistent field ``<field name>``.
* **models.E013**: ``constraints/indexes/index_together/unique_together``
refers to a ``ManyToManyField`` ``<field name>``, but ``ManyToManyField``\s
are not supported for that option.
* **models.E012**: ``constraints/indexes/unique_together`` refers to the
nonexistent field ``<field name>``.
* **models.E013**: ``constraints/indexes/unique_together`` refers to a
``ManyToManyField`` ``<field name>``, but ``ManyToManyField``\s are not
supported for that option.
* **models.E014**: ``ordering`` must be a tuple or list (even if you want to
order by only one field).
* **models.E015**: ``ordering`` refers to the nonexistent field, related field,
or lookup ``<field name>``.
* **models.E016**: ``constraints/indexes/index_together/unique_together``
refers to field ``<field_name>`` which is not local to model ``<model>``.
* **models.E016**: ``constraints/indexes/unique_together`` refers to field
``<field_name>`` which is not local to model ``<model>``.
* **models.E017**: Proxy model ``<model>`` contains model fields.
* **models.E018**: Autogenerated column name too long for field ``<field>``.
Maximum length is ``<maximum length>`` for database ``<alias>``.

View file

@ -247,7 +247,7 @@ Removes the index named ``name`` from the model with ``model_name``.
Renames an index in the database table for the model with ``model_name``.
Exactly one of ``old_name`` and ``old_fields`` can be provided. ``old_fields``
is an iterable of the strings, often corresponding to fields of
:attr:`~django.db.models.Options.index_together`.
``index_together`` (pre-Django 5.1 option).
On databases that don't support an index renaming statement (SQLite and MariaDB
< 10.5.2), the operation will drop and recreate the index, which can be

View file

@ -451,29 +451,6 @@ not be looking at your Django code. For example::
The ``ValidationError`` raised during model validation when the constraint
is violated has the ``unique_together`` error code.
``index_together``
------------------
.. attribute:: Options.index_together
Sets of field names that, taken together, are indexed::
index_together = [
["pub_date", "deadline"],
]
This list of fields will be indexed together (i.e. the appropriate
``CREATE INDEX`` statement will be issued.)
For convenience, ``index_together`` can be a single list when dealing with a single
set of fields::
index_together = ["pub_date", "deadline"]
.. deprecated:: 4.2
Use the :attr:`~Options.indexes` option instead.
``constraints``
---------------

View file

@ -114,9 +114,8 @@ the new value.
.. method:: BaseDatabaseSchemaEditor.alter_index_together(model, old_index_together, new_index_together)
Changes a model's :attr:`~django.db.models.Options.index_together` value; this
will add or remove indexes from the model's table until they match the new
value.
Changes a model's ``index_together`` value; this will add or remove indexes
from the model's table until they match the new value.
``alter_db_table()``
--------------------