summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2013-07-26 16:39:44 +0100
committerAndrew Godwin <andrew@aeracode.org>2013-07-26 16:39:44 +0100
commitc1ed21fa9ee5f64bcf6f70fa30580989bd579a91 (patch)
tree7815ae05b022146f5019e46bc94413825b9dc9c6
parent6b39010d5793689af2d3e5d9a2f9e92d99d0f105 (diff)
Use new transaction API in syncdb section of migrate
-rw-r--r--django/core/management/commands/migrate.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/django/core/management/commands/migrate.py b/django/core/management/commands/migrate.py
index d9fbb846ac..882ebde073 100644
--- a/django/core/management/commands/migrate.py
+++ b/django/core/management/commands/migrate.py
@@ -12,7 +12,7 @@ from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.loader import AmbiguityError
from django.utils.datastructures import SortedDict
from django.utils.importlib import import_module
-from django.utils.module_loading import module_has_submodule, import_by_path
+from django.utils.module_loading import module_has_submodule
class Command(BaseCommand):
@@ -162,7 +162,7 @@ class Command(BaseCommand):
# Create the tables for each model
if self.verbosity >= 1:
self.stdout.write(" Creating tables...\n")
- with transaction.commit_on_success_unless_managed(using=connection.alias):
+ with transaction.atomic(using=connection.alias, savepoint=False):
for app_name, model_list in manifest.items():
for model in model_list:
# Create the model's database table, if it doesn't already exist.
@@ -181,6 +181,10 @@ class Command(BaseCommand):
for statement in sql:
cursor.execute(statement)
tables.append(connection.introspection.table_name_converter(model._meta.db_table))
+
+ # We force a commit here, as that was the previous behaviour.
+ # If you can prove we don't need this, remove it.
+ transaction.set_dirty(using=connection.alias)
# Send the post_syncdb signal, so individual apps can do whatever they need
# to do at this point.