Fixed transaction handling in two management commands.

Previously, when createcachetable and flush operated on non-default
databases, they weren't atomic.
This commit is contained in:
Aymeric Augustin 2014-03-21 18:48:57 +01:00
parent 0f9560855e
commit 753a22a635
3 changed files with 7 additions and 5 deletions

View file

@ -981,9 +981,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)