mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Refs #27064 -- Added RenameIndex migration operation.
This commit is contained in:
parent
20e65a34ae
commit
eacd4977f6
14 changed files with 411 additions and 1 deletions
|
@ -222,6 +222,22 @@ Creates an index in the database table for the model with ``model_name``.
|
|||
|
||||
Removes the index named ``name`` from the model with ``model_name``.
|
||||
|
||||
``RenameIndex``
|
||||
---------------
|
||||
|
||||
.. versionadded:: 4.1
|
||||
|
||||
.. class:: RenameIndex(model_name, new_name, old_name=None, old_fields=None)
|
||||
|
||||
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`.
|
||||
|
||||
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
|
||||
expensive.
|
||||
|
||||
``AddConstraint``
|
||||
-----------------
|
||||
|
||||
|
|
|
@ -79,6 +79,15 @@ Adds ``index`` to ``model``’s table.
|
|||
|
||||
Removes ``index`` from ``model``’s table.
|
||||
|
||||
``rename_index()``
|
||||
------------------
|
||||
|
||||
.. versionadded:: 4.1
|
||||
|
||||
.. method:: BaseDatabaseSchemaEditor.rename_index(model, old_index, new_index)
|
||||
|
||||
Renames ``old_index`` from ``model``’s table to ``new_index``.
|
||||
|
||||
``add_constraint()``
|
||||
--------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue