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(using=database): 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 @@ -62,7 +62,7 @@ Are you sure you want to do this? if confirm == 'yes': try: with transaction.commit_on_success_unless_managed(): with transaction.atomic(using=db): with connection.cursor() as cursor: for sql in sql_list: cursor.execute(sql) Loading docs/releases/1.6.6.txt +4 −0 Original line number Diff line number Diff line Loading @@ -22,3 +22,7 @@ Bugfixes * Restored ``pre_delete`` signals for ``GenericRelation`` cascade deletion (`#22998 <https://code.djangoproject.com/ticket/22998>`_). * Fixed transaction handling when specifying non-default database in ``createcachetable`` and ``flush`` (`#23089 <https://code.djangoproject.com/ticket/23089>`_). tests/cache/tests.py +5 −3 Original line number Diff line number Diff line Loading @@ -989,9 +989,11 @@ class CreateCacheTableForDBCacheTests(TestCase): # cache table should be created on 'other' # Queries: # 1: check table doesn't already exist # 2: create the table # 3: create the index with self.assertNumQueries(3, using='other'): # 2: create savepoint # 3: create the table # 4: create the index # 5: release savepoint with self.assertNumQueries(5, using='other'): management.call_command('createcachetable', database='other', verbosity=0, interactive=False) Loading 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(using=database): 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 @@ -62,7 +62,7 @@ Are you sure you want to do this? if confirm == 'yes': try: with transaction.commit_on_success_unless_managed(): with transaction.atomic(using=db): with connection.cursor() as cursor: for sql in sql_list: cursor.execute(sql) Loading
docs/releases/1.6.6.txt +4 −0 Original line number Diff line number Diff line Loading @@ -22,3 +22,7 @@ Bugfixes * Restored ``pre_delete`` signals for ``GenericRelation`` cascade deletion (`#22998 <https://code.djangoproject.com/ticket/22998>`_). * Fixed transaction handling when specifying non-default database in ``createcachetable`` and ``flush`` (`#23089 <https://code.djangoproject.com/ticket/23089>`_).
tests/cache/tests.py +5 −3 Original line number Diff line number Diff line Loading @@ -989,9 +989,11 @@ class CreateCacheTableForDBCacheTests(TestCase): # cache table should be created on 'other' # Queries: # 1: check table doesn't already exist # 2: create the table # 3: create the index with self.assertNumQueries(3, using='other'): # 2: create savepoint # 3: create the table # 4: create the index # 5: release savepoint with self.assertNumQueries(5, using='other'): management.call_command('createcachetable', database='other', verbosity=0, interactive=False) Loading