(self)
| 1086 | AddAutoFieldModel.objects.create(name="test") |
| 1087 | |
| 1088 | def test_remove_field(self): |
| 1089 | with connection.schema_editor() as editor: |
| 1090 | editor.create_model(Author) |
| 1091 | with CaptureQueriesContext(connection) as ctx: |
| 1092 | editor.remove_field(Author, Author._meta.get_field("name")) |
| 1093 | columns = self.column_classes(Author) |
| 1094 | self.assertNotIn("name", columns) |
| 1095 | if getattr(connection.features, "can_alter_table_drop_column", True): |
| 1096 | # Table is not rebuilt. |
| 1097 | self.assertIs( |
| 1098 | any("CREATE TABLE" in query["sql"] for query in ctx.captured_queries), |
| 1099 | False, |
| 1100 | ) |
| 1101 | self.assertIs( |
| 1102 | any("DROP TABLE" in query["sql"] for query in ctx.captured_queries), |
| 1103 | False, |
| 1104 | ) |
| 1105 | |
| 1106 | def test_remove_indexed_field(self): |
| 1107 | with connection.schema_editor() as editor: |
nothing calls this directly
no test coverage detected