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:
@@ -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):
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user