Skip to content

Commit 98634bc

Browse files
committed
Call createcachecollection command in create_test_db
1 parent b4107d6 commit 98634bc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

django_mongodb_backend/creation.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.conf import settings
2+
from django.core.management import call_command
23
from django.db.backends.base.creation import BaseDatabaseCreation
34

45

@@ -16,3 +17,8 @@ def _destroy_test_db(self, test_database_name, verbosity):
1617
for collection in self.connection.introspection.table_names():
1718
if not collection.startswith("system."):
1819
self.connection.database.drop_collection(collection)
20+
21+
def create_test_db(self, *args, **kwargs):
22+
test_database_name = super().create_test_db(*args, **kwargs)
23+
call_command("createcachecollection", database=self.connection.alias)
24+
return test_database_name

0 commit comments

Comments
 (0)