0
0
mirror of https://github.com/django/django.git synced 2024-12-01 15:42:04 +01:00

Fixed #25357 -- Database deduplication on Oracle.

In order to reuse another database, Django must use set_as_test_mirror.
This commit is contained in:
Aymeric Augustin 2015-09-05 20:00:33 +02:00
parent 5ace1887f2
commit 79c3f226dd

View File

@ -377,22 +377,23 @@ def setup_databases(verbosity, interactive, keepdb=False, debug_sql=False, **kwa
mirrors = []
for signature, (db_name, aliases) in test_databases.items():
test_db_name = None
first_alias = None
# Actually create the database for the first connection
for alias in aliases:
connection = connections[alias]
if test_db_name is None:
test_db_name = connection.creation.create_test_db(
old_names.append((connection, db_name, first_alias is None))
if first_alias is None:
first_alias = alias
connection.creation.create_test_db(
verbosity,
autoclobber=not interactive,
keepdb=keepdb,
serialize=connection.settings_dict.get("TEST", {}).get("SERIALIZE", True),
)
destroy = True
else:
connection.settings_dict['NAME'] = test_db_name
destroy = False
old_names.append((connection, db_name, destroy))
connections[alias].creation.set_as_test_mirror(
connections[first_alias].settings_dict)
for alias, mirror_alias in mirrored_aliases.items():
mirrors.append((alias, connections[alias].settings_dict['NAME']))