diff options
| author | Andrew Godwin <andrew@aeracode.org> | 2014-05-07 14:28:34 -0700 |
|---|---|---|
| committer | Andrew Godwin <andrew@aeracode.org> | 2014-05-07 14:29:04 -0700 |
| commit | 7f63ac5a9f0ed76d2e372a8c0fda95cce67e7170 (patch) | |
| tree | 9b7fe73159a27cc810bfb82c99bee29f3ffd9bc4 /docs | |
| parent | d8bf415ab29ef3ef843286e69c646ebcce58c172 (diff) | |
[1.7.x] Fixed #22496: Data migrations get transactions again!
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/ref/migration-operations.txt | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/docs/ref/migration-operations.txt b/docs/ref/migration-operations.txt index 0b7e6a3912..9c7a5d497e 100644 --- a/docs/ref/migration-operations.txt +++ b/docs/ref/migration-operations.txt @@ -178,7 +178,7 @@ operation that adds that field and so will try to run it again). RunPython --------- -.. class:: RunPython(code, reverse_code=None) +.. class:: RunPython(code, reverse_code=None, atomic=True) Runs custom Python code in a historical context. ``code`` (and ``reverse_code`` if supplied) should be callable objects that accept two arguments; the first is @@ -230,6 +230,12 @@ or that you use :class:`SeparateDatabaseAndState` to add in operations that will reflect your changes to the model state - otherwise, the versioned ORM and the autodetector will stop working correctly. +By default, ``RunPython`` will run its contents inside a transaction even +on databases that do not support DDL transactions (for example, MySQL and +Oracle). This should be safe, but may cause a crash if you attempt to use +the ``schema_editor`` provided on these backends; in this case, please +set ``atomic=False``. + SeparateDatabaseAndState ------------------------ |
