mirror of
https://github.com/django/django.git
synced 2025-07-29 08:04:27 +00:00
Moved SearchVectorIndexTests.test_search_vector_index to postgres_tests.test_indexes.
This commit is contained in:
parent
263db8af46
commit
02a04ab79a
2 changed files with 15 additions and 21 deletions
|
@ -539,6 +539,21 @@ class SchemaTests(PostgreSQLTestCase):
|
|||
editor.remove_index(Scene, index)
|
||||
self.assertNotIn(index_name, self.get_constraints(table))
|
||||
|
||||
def test_search_vector(self):
|
||||
"""SearchVector generates IMMUTABLE SQL in order to be indexable."""
|
||||
index_name = "test_search_vector"
|
||||
index = Index(SearchVector("id", "scene", config="english"), name=index_name)
|
||||
# Indexed function must be IMMUTABLE.
|
||||
with connection.schema_editor() as editor:
|
||||
editor.add_index(Scene, index)
|
||||
constraints = self.get_constraints(Scene._meta.db_table)
|
||||
self.assertIn(index_name, constraints)
|
||||
self.assertIs(constraints[index_name]["index"], True)
|
||||
|
||||
with connection.schema_editor() as editor:
|
||||
editor.remove_index(Scene, index)
|
||||
self.assertNotIn(index_name, self.get_constraints(Scene._meta.db_table))
|
||||
|
||||
def test_hash_index(self):
|
||||
# Ensure the table is there and doesn't have an index.
|
||||
self.assertNotIn("field", self.get_constraints(CharFieldModel._meta.db_table))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue