summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMarkus Holtermann <info@markusholtermann.eu>2015-01-08 18:00:04 +0100
committerTim Graham <timograham@gmail.com>2015-01-09 10:31:32 -0500
commitc8bac4b556cf4716dc9003e5da48060cb72ba7cb (patch)
tree8d75e220aa544e30a3b7582ff26fa701562437b4 /docs
parent67d6a8c4e66c379111d0acf4552e162356917dd7 (diff)
Fixed #24098 -- Added no-op attributes to RunPython and RunSQL
Thanks Loïc Bistuer and Tim Graham for the discussion and review.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/migration-operations.txt16
-rw-r--r--docs/releases/1.8.txt5
2 files changed, 21 insertions, 0 deletions
diff --git a/docs/ref/migration-operations.txt b/docs/ref/migration-operations.txt
index 46b87f44c4..dcac7f26a6 100644
--- a/docs/ref/migration-operations.txt
+++ b/docs/ref/migration-operations.txt
@@ -245,6 +245,14 @@ operation that adds that field and so will try to run it again).
The ability to pass parameters to the ``sql`` and ``reverse_sql`` queries
was added.
+.. attribute:: RunSQL.noop
+
+ .. versionadded:: 1.8
+
+ Pass the ``RunSQL.noop`` attribute to ``sql`` or ``reverse_sql`` when you
+ want the operation not to do anything in the given direction. This is
+ especially useful in making the operation reversible.
+
.. _sqlparse: https://pypi.python.org/pypi/sqlparse
RunPython
@@ -321,6 +329,14 @@ set ``atomic=False``.
``schema_editor.connection.alias``, where ``schema_editor`` is the second
argument to your function).
+.. staticmethod:: RunPython.noop
+
+ .. versionadded:: 1.8
+
+ Pass the ``RunPython.noop`` method to ``code`` or ``reverse_code`` when
+ you want the operation not to do anything in the given direction. This is
+ especially useful in making the operation reversible.
+
SeparateDatabaseAndState
------------------------
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 3a522ee741..427ec5d493 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -457,6 +457,11 @@ Migrations
* A :ref:`generic mechanism to handle the deprecation of model fields
<migrations-removing-model-fields>` was added.
+* The :attr:`RunPython.noop <django.db.migrations.operations.RunPython.noop>`
+ and :meth:`RunSQL.noop() <django.db.migrations.operations.RunSQL.noop>` class
+ attribute/method were added to ease in making ``RunPython`` and ``RunSQL``
+ operations reversible.
+
Models
^^^^^^