From dcb27ead84a91e8d38a183cfc2f7640141eb40f8 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Wed, 22 Jul 2020 12:49:56 +0200 Subject: [PATCH] [3.0.x] Fixed #31805 -- Fixed SchemaTests.tearDown() when table names are case-insensitive. Backport of fd53db842c35c994dbd54196dd38a908f3676b1a from master --- tests/schema/tests.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/schema/tests.py b/tests/schema/tests.py index d8680501bc..9a84969447 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -94,8 +94,12 @@ class SchemaTests(TransactionTestCase): with connection.schema_editor() as editor: connection.disable_constraint_checking() table_names = connection.introspection.table_names() + if connection.features.ignores_table_name_case: + table_names = [table_name.lower() for table_name in table_names] for model in itertools.chain(SchemaTests.models, self.local_models): tbl = converter(model._meta.db_table) + if connection.features.ignores_table_name_case: + tbl = tbl.lower() if tbl in table_names: editor.delete_model(model) table_names.remove(tbl)