summaryrefslogtreecommitdiff
path: root/docs/ref/django-admin.txt
diff options
context:
space:
mode:
authorDavid Wobrock <david.wobrock@gmail.com>2022-01-01 23:33:08 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-22 10:30:40 +0100
commit7c318a8bdd66f8c5241864c9970dddb525d0ca4c (patch)
tree12f13d585caa1fef4686fdf51c04697cd979ae4f /docs/ref/django-admin.txt
parent847f46e9bf88964484c8b76a10af753ea1018311 (diff)
Fixed #27844 -- Added optimizemigration management command.
Diffstat (limited to 'docs/ref/django-admin.txt')
-rw-r--r--docs/ref/django-admin.txt22
1 files changed, 20 insertions, 2 deletions
diff --git a/docs/ref/django-admin.txt b/docs/ref/django-admin.txt
index 793461c265..326611d786 100644
--- a/docs/ref/django-admin.txt
+++ b/docs/ref/django-admin.txt
@@ -916,6 +916,23 @@ Deletes nonexistent migrations from the ``django_migrations`` table. This is
useful when migration files replaced by a squashed migration have been removed.
See :ref:`migration-squashing` for more details.
+``optimizemigration``
+---------------------
+
+.. versionadded:: 4.1
+
+.. django-admin:: optimizemigration app_label migration_name
+
+Optimizes the operations for the named migration and overrides the existing
+file. If the migration contains functions that must be manually copied, the
+command creates a new migration file suffixed with ``_optimized`` that is meant
+to replace the named migration.
+
+.. django-admin-option:: --check
+
+Makes ``optimizemigration`` exit with a non-zero status when a migration can be
+optimized.
+
``runserver``
-------------
@@ -2056,8 +2073,9 @@ Black formatting
.. versionadded:: 4.1
The Python files created by :djadmin:`startproject`, :djadmin:`startapp`,
-:djadmin:`makemigrations`, and :djadmin:`squashmigrations` are formatted using
-the ``black`` command if it is present on your ``PATH``.
+:djadmin:`optimizemigration`, :djadmin:`makemigrations`, and
+:djadmin:`squashmigrations` are formatted using the ``black`` command if it is
+present on your ``PATH``.
If you have ``black`` globally installed, but do not wish it used for the
current project, you can set the ``PATH`` explicitly::