(self)
| 4179 | |
| 4180 | @skipUnlessDBFeature("supports_expression_indexes") |
| 4181 | def test_func_index(self): |
| 4182 | with connection.schema_editor() as editor: |
| 4183 | editor.create_model(Author) |
| 4184 | index = Index(Lower("name").desc(), name="func_lower_idx") |
| 4185 | # Add index. |
| 4186 | with connection.schema_editor() as editor: |
| 4187 | editor.add_index(Author, index) |
| 4188 | sql = index.create_sql(Author, editor) |
| 4189 | table = Author._meta.db_table |
| 4190 | if connection.features.supports_index_column_ordering: |
| 4191 | self.assertIndexOrder(table, index.name, ["DESC"]) |
| 4192 | # SQL contains a database function. |
| 4193 | self.assertIs(sql.references_column(table, "name"), True) |
| 4194 | self.assertIn("LOWER(%s)" % editor.quote_name("name"), str(sql)) |
| 4195 | # Remove index. |
| 4196 | with connection.schema_editor() as editor: |
| 4197 | editor.remove_index(Author, index) |
| 4198 | self.assertNotIn(index.name, self.get_constraints(table)) |
| 4199 | |
| 4200 | @skipUnlessDBFeature("supports_expression_indexes") |
| 4201 | def test_func_index_f(self): |
nothing calls this directly
no test coverage detected