(self)
| 4199 | |
| 4200 | @skipUnlessDBFeature("supports_expression_indexes") |
| 4201 | def test_func_index_f(self): |
| 4202 | with connection.schema_editor() as editor: |
| 4203 | editor.create_model(Tag) |
| 4204 | index = Index("slug", F("title").desc(), name="func_f_idx") |
| 4205 | # Add index. |
| 4206 | with connection.schema_editor() as editor: |
| 4207 | editor.add_index(Tag, index) |
| 4208 | sql = index.create_sql(Tag, editor) |
| 4209 | table = Tag._meta.db_table |
| 4210 | self.assertIn(index.name, self.get_constraints(table)) |
| 4211 | if connection.features.supports_index_column_ordering: |
| 4212 | self.assertIndexOrder(Tag._meta.db_table, index.name, ["ASC", "DESC"]) |
| 4213 | # SQL contains columns. |
| 4214 | self.assertIs(sql.references_column(table, "slug"), True) |
| 4215 | self.assertIs(sql.references_column(table, "title"), True) |
| 4216 | # Remove index. |
| 4217 | with connection.schema_editor() as editor: |
| 4218 | editor.remove_index(Tag, index) |
| 4219 | self.assertNotIn(index.name, self.get_constraints(table)) |
| 4220 | |
| 4221 | @skipUnlessDBFeature("supports_expression_indexes") |
| 4222 | def test_func_index_lookups(self): |
nothing calls this directly
no test coverage detected