From 23f3c53aff54b7f298f29e97042d00dbd9379d00 Mon Sep 17 00:00:00 2001 From: Tim Graham Date: Sun, 27 Apr 2014 15:19:54 -0400 Subject: [PATCH] [1.7.x] Fixed #22445 -- Added how to perform a reverse data migration to topic guide. Thanks Karen Tracey for the report. Backport of 1ce759b69f from master --- docs/topics/migrations.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/topics/migrations.txt b/docs/topics/migrations.txt index c78e395305..5afdaf2d72 100644 --- a/docs/topics/migrations.txt +++ b/docs/topics/migrations.txt @@ -389,6 +389,11 @@ need to do is use the historical model and iterate over the rows:: Once that's done, we can just run ``python manage.py migrate`` as normal and the data migration will run in place alongside other migrations. +You can pass a second callable to +:class:`~django.db.migrations.operations.RunPython` to run whatever logic you +want executed when migrating backwards. If this callable is omitted, migrating +backwards will raise an exception. + If you're interested in the more advanced migration operations, or want to be able to write your own, see the :doc:`migration operations reference `.