mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
[3.0.x] Fixed #30597 -- Clarified how to unapply migrations.
Backport of 45554fd5c5
from master
This commit is contained in:
parent
5d40de0856
commit
0c655f1df2
2 changed files with 26 additions and 2 deletions
|
@ -347,6 +347,30 @@ Note that this only works given two things:
|
|||
that your database doesn't match your models, you'll just get errors when
|
||||
migrations try to modify those tables.
|
||||
|
||||
Reverting migrations
|
||||
====================
|
||||
|
||||
Any migration can be reverted with :djadmin:`migrate` by using the number of
|
||||
previous migrations::
|
||||
|
||||
$ python manage.py migrate books 0002
|
||||
Operations to perform:
|
||||
Target specific migration: 0002_auto, from books
|
||||
Running migrations:
|
||||
Rendering model states... DONE
|
||||
Unapplying books.0003_auto... OK
|
||||
|
||||
If you want to revert all migrations applied for an app, use the name
|
||||
``zero``::
|
||||
|
||||
$ python manage.py migrate books zero
|
||||
Operations to perform:
|
||||
Unapply all migrations: books
|
||||
Running migrations:
|
||||
Rendering model states... DONE
|
||||
Unapplying books.0002_auto... OK
|
||||
Unapplying books.0001_initial... OK
|
||||
|
||||
.. _historical-models:
|
||||
|
||||
Historical models
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue