1
0
mirror of https://github.com/django/django.git synced 2025-10-27 07:36:08 +00:00

Fixed #22496: Data migrations get transactions again!

This commit is contained in:
Andrew Godwin
2014-05-07 14:28:34 -07:00
parent e9a456d11b
commit 5a917cfef3
5 changed files with 65 additions and 4 deletions

View File

@@ -24,6 +24,10 @@ class Operation(object):
# Can this migration be represented as SQL? (things like RunPython cannot)
reduces_to_sql = True
# Should this operation be forced as atomic even on backends with no
# DDL transaction support (i.e., does it have no DDL, like RunPython)
atomic = False
serialization_expand_args = []
def __new__(cls, *args, **kwargs):

View File

@@ -86,7 +86,8 @@ class RunPython(Operation):
reduces_to_sql = False
def __init__(self, code, reverse_code=None):
def __init__(self, code, reverse_code=None, atomic=True):
self.atomic = atomic
# Forwards code
if not callable(code):
raise ValueError("RunPython must be supplied with a callable")