From c8bac4b556cf4716dc9003e5da48060cb72ba7cb Mon Sep 17 00:00:00 2001 From: Markus Holtermann Date: Thu, 8 Jan 2015 18:00:04 +0100 Subject: Fixed #24098 -- Added no-op attributes to RunPython and RunSQL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks Loïc Bistuer and Tim Graham for the discussion and review. --- docs/ref/migration-operations.txt | 16 ++++++++++++++++ docs/releases/1.8.txt | 5 +++++ 2 files changed, 21 insertions(+) (limited to 'docs') 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 ` was added. +* The :attr:`RunPython.noop ` + and :meth:`RunSQL.noop() ` class + attribute/method were added to ease in making ``RunPython`` and ``RunSQL`` + operations reversible. + Models ^^^^^^ -- cgit v1.3