summaryrefslogtreecommitdiff
path: root/docs/topics
diff options
context:
space:
mode:
authorDavid Vaz <davidmgvaz@gmail.com>2019-09-26 10:39:36 -0700
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2019-09-27 22:41:16 +0200
commit4116b369b191f1830bbe761fa7fb29bf1becc8ef (patch)
treec3ce10053a934e65f4d18e936442f6e147ac0c09 /docs/topics
parent1ac2f25ec091847a2db313210eb9743ed3b0dabf (diff)
[2.2.x] Fixed #30597 -- Clarified how to unapply migrations.
Backport of 45554fd5c5c6a536db3ce70d78646d3dc398cf08 from master
Diffstat (limited to 'docs/topics')
-rw-r--r--docs/topics/migrations.txt24
1 files changed, 24 insertions, 0 deletions
diff --git a/docs/topics/migrations.txt b/docs/topics/migrations.txt
index d71816d9a3..871f61a7b6 100644
--- a/docs/topics/migrations.txt
+++ b/docs/topics/migrations.txt
@@ -349,6 +349,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