Deletes all model tables for our models for a clean test environment
(self)
| 162 | editor.delete_model(model) |
| 163 | |
| 164 | def delete_tables(self): |
| 165 | "Deletes all model tables for our models for a clean test environment" |
| 166 | converter = connection.introspection.identifier_converter |
| 167 | with connection.schema_editor() as editor: |
| 168 | connection.disable_constraint_checking() |
| 169 | table_names = connection.introspection.table_names() |
| 170 | if connection.features.ignores_table_name_case: |
| 171 | table_names = [table_name.lower() for table_name in table_names] |
| 172 | for model in itertools.chain(SchemaTests.models, self.local_models): |
| 173 | tbl = converter(model._meta.db_table) |
| 174 | if connection.features.ignores_table_name_case: |
| 175 | tbl = tbl.lower() |
| 176 | if tbl in table_names: |
| 177 | editor.delete_model(model) |
| 178 | table_names.remove(tbl) |
| 179 | connection.enable_constraint_checking() |
| 180 | |
| 181 | def column_classes(self, model): |
| 182 | with connection.cursor() as cursor: |
no test coverage detected