From e74d2183c28467aefc0b87e3fa6d405dbfdea82c Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Wed, 23 Apr 2014 21:34:57 +0200 Subject: [PATCH] Wrapped migrations in a transaction only on DBs with transactional DDL. --- django/db/backends/schema.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/django/db/backends/schema.py b/django/db/backends/schema.py index 63b0725e22..d187c48046 100644 --- a/django/db/backends/schema.py +++ b/django/db/backends/schema.py @@ -71,14 +71,16 @@ class BaseDatabaseSchemaEditor(object): def __enter__(self): self.deferred_sql = [] - atomic(self.connection.alias, self.connection.features.can_rollback_ddl).__enter__() + if self.connection.features.can_rollback_ddl: + atomic(self.connection.alias).__enter__() return self def __exit__(self, exc_type, exc_value, traceback): if exc_type is None: for sql in self.deferred_sql: self.execute(sql) - atomic(self.connection.alias, self.connection.features.can_rollback_ddl).__exit__(exc_type, exc_value, traceback) + if self.connection.features.can_rollback_ddl: + atomic(self.connection.alias).__exit__(exc_type, exc_value, traceback) # Core utility functions