Loading django/contrib/contenttypes/fields.py +1 −1 Original line number Diff line number Diff line Loading @@ -500,7 +500,7 @@ def create_generic_related_manager(superclass): if bulk: queryset.delete() else: with transaction.commit_on_success_unless_managed(using=db, savepoint=False): with transaction.atomic(using=db, savepoint=False): for obj in queryset: obj.delete() _clear.alters_data = True Loading django/core/management/commands/createcachetable.py +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class Command(BaseCommand): for i, line in enumerate(table_output): full_statement.append(' %s%s' % (line, ',' if i < len(table_output) - 1 else '')) full_statement.append(');') with transaction.commit_on_success_unless_managed(): with transaction.atomic(): with connection.cursor() as curs: try: curs.execute("\n".join(full_statement)) Loading django/core/management/commands/flush.py +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ Are you sure you want to do this? if confirm == 'yes': try: with transaction.commit_on_success_unless_managed(): with transaction.atomic(): with connection.cursor() as cursor: for sql in sql_list: cursor.execute(sql) Loading django/core/management/commands/loaddata.py +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ class Command(BaseCommand): self.verbosity = int(options.get('verbosity')) with transaction.commit_on_success_unless_managed(using=self.using): with transaction.atomic(using=self.using): self.loaddata(fixture_labels) # Close the DB connection -- unless we're still in a transaction. This Loading django/core/management/commands/migrate.py +2 −6 Original line number Diff line number Diff line Loading @@ -223,10 +223,6 @@ 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 behavior. # If you can prove we don't need this, remove it. transaction.set_dirty(using=connection.alias) finally: cursor.close() Loading @@ -245,7 +241,7 @@ class Command(BaseCommand): if self.verbosity >= 2: self.stdout.write(" Installing custom SQL for %s.%s model\n" % (app_name, model._meta.object_name)) try: with transaction.commit_on_success_unless_managed(using=connection.alias): with transaction.atomic(using=connection.alias): for sql in custom_sql: cursor.execute(sql) except Exception as e: Loading @@ -268,7 +264,7 @@ class Command(BaseCommand): if self.verbosity >= 2: self.stdout.write(" Installing index for %s.%s model\n" % (app_name, model._meta.object_name)) try: with transaction.commit_on_success_unless_managed(using=connection.alias): with transaction.atomic(using=connection.alias): for sql in index_sql: cursor.execute(sql) except Exception as e: Loading Loading
django/contrib/contenttypes/fields.py +1 −1 Original line number Diff line number Diff line Loading @@ -500,7 +500,7 @@ def create_generic_related_manager(superclass): if bulk: queryset.delete() else: with transaction.commit_on_success_unless_managed(using=db, savepoint=False): with transaction.atomic(using=db, savepoint=False): for obj in queryset: obj.delete() _clear.alters_data = True Loading
django/core/management/commands/createcachetable.py +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class Command(BaseCommand): for i, line in enumerate(table_output): full_statement.append(' %s%s' % (line, ',' if i < len(table_output) - 1 else '')) full_statement.append(');') with transaction.commit_on_success_unless_managed(): with transaction.atomic(): with connection.cursor() as curs: try: curs.execute("\n".join(full_statement)) Loading
django/core/management/commands/flush.py +1 −1 Original line number Diff line number Diff line Loading @@ -63,7 +63,7 @@ Are you sure you want to do this? if confirm == 'yes': try: with transaction.commit_on_success_unless_managed(): with transaction.atomic(): with connection.cursor() as cursor: for sql in sql_list: cursor.execute(sql) Loading
django/core/management/commands/loaddata.py +1 −1 Original line number Diff line number Diff line Loading @@ -56,7 +56,7 @@ class Command(BaseCommand): self.verbosity = int(options.get('verbosity')) with transaction.commit_on_success_unless_managed(using=self.using): with transaction.atomic(using=self.using): self.loaddata(fixture_labels) # Close the DB connection -- unless we're still in a transaction. This Loading
django/core/management/commands/migrate.py +2 −6 Original line number Diff line number Diff line Loading @@ -223,10 +223,6 @@ 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 behavior. # If you can prove we don't need this, remove it. transaction.set_dirty(using=connection.alias) finally: cursor.close() Loading @@ -245,7 +241,7 @@ class Command(BaseCommand): if self.verbosity >= 2: self.stdout.write(" Installing custom SQL for %s.%s model\n" % (app_name, model._meta.object_name)) try: with transaction.commit_on_success_unless_managed(using=connection.alias): with transaction.atomic(using=connection.alias): for sql in custom_sql: cursor.execute(sql) except Exception as e: Loading @@ -268,7 +264,7 @@ class Command(BaseCommand): if self.verbosity >= 2: self.stdout.write(" Installing index for %s.%s model\n" % (app_name, model._meta.object_name)) try: with transaction.commit_on_success_unless_managed(using=connection.alias): with transaction.atomic(using=connection.alias): for sql in index_sql: cursor.execute(sql) except Exception as e: Loading