1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #23359 -- Added showmigrations command to list migrations and plan.

Thanks to Collin Anderson, Tim Graham, Gabe Jackson, and Marc Tamlyn
for their input, ideas, and review.
This commit is contained in:
Markus Holtermann
2014-09-03 10:51:07 +02:00
committed by Tim Graham
parent 8952757698
commit a1487deebf
7 changed files with 314 additions and 57 deletions

View File

@@ -123,6 +123,8 @@ details on these changes.
* Private attribute ``django.db.models.Field.related`` will be removed.
* The ``--list`` option of the ``migrate`` management command will be removed.
.. _deprecation-removed-in-1.9:
1.9

View File

@@ -770,15 +770,10 @@ be warned that using ``--fake`` runs the risk of putting the migration state
table into a state where manual recovery will be needed to make migrations
run correctly.
.. django-admin-option:: --list, -l
The ``--list`` option will list all of the apps Django knows about, the
migrations available for each app and if they are applied or not (marked by
an ``[X]`` next to the migration name).
Apps without migrations are also included in the list, but will have
``(no migrations)`` printed under them.
.. deprecated:: 1.8
The ``--list`` option has been moved to the :djadmin:`showmigrations`
command.
runfcgi [options]
-----------------
@@ -1088,6 +1083,32 @@ behavior you can use the ``--no-startup`` option. e.g.::
django-admin shell --plain --no-startup
showmigrations [<app_label> [<app_label>]]
------------------------------------------
.. django-admin:: showmigrations
.. versionadded:: 1.8
Shows all migrations in a project.
.. django-admin-option:: --list, -l
The ``--list`` option lists all of the apps Django knows about, the
migrations available for each app, and whether or not each migrations is
applied (marked by an ``[X]`` next to the migration name).
Apps without migrations are also listed, but have ``(no migrations)`` printed
under them.
.. django-admin-option:: --plan, -p
The ``--plan`` option shows the migration plan Django will follow to apply
migrations. Any supplied app labels are ignored because the plan might go
beyond those apps. Same as ``--list``, applied migrations are marked by an
``[X]``. For a verbosity of 2 and above, all dependencies of a migration will
also be shown.
sql <app_label app_label ...>
-----------------------------

View File

@@ -394,6 +394,9 @@ Management Commands
* :djadmin:`makemigrations` now supports an :djadminopt:`--exit` option to
exit with an error code if no migrations are created.
* The new :djadmin:`showmigrations` command allows listing all migrations and
their dependencies in a project.
Middleware
^^^^^^^^^^
@@ -1134,6 +1137,13 @@ The class :class:`~django.core.management.NoArgsCommand` is now deprecated and
will be removed in Django 2.0. Use :class:`~django.core.management.BaseCommand`
instead, which takes no arguments by default.
Listing all migrations in a project
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``--list`` option of the :djadmin:`migrate` management command is
deprecated and will be removed in Django 2.0. Use :djadmin:`showmigrations`
instead.
``cache_choices`` option of ``ModelChoiceField`` and ``ModelMultipleChoiceField``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~