mirror of https://github.com/django/django.git
Refs #27236 -- Removed usage of Meta.index_together from indexes/introspection test models.
This commit is contained in:
parent
77330a089c
commit
f8f16b3cd8
|
@ -38,9 +38,7 @@ class Article(models.Model):
|
|||
)
|
||||
|
||||
class Meta:
|
||||
index_together = [
|
||||
["headline", "pub_date"],
|
||||
]
|
||||
indexes = [models.Index(fields=["headline", "pub_date"])]
|
||||
|
||||
|
||||
class IndexedArticle(models.Model):
|
||||
|
|
|
@ -68,17 +68,13 @@ class SchemaIndexesTests(TestCase):
|
|||
)
|
||||
self.assertEqual(index_name, expected[connection.vendor])
|
||||
|
||||
def test_index_together(self):
|
||||
def test_quoted_index_name(self):
|
||||
editor = connection.schema_editor()
|
||||
index_sql = [str(statement) for statement in editor._model_indexes_sql(Article)]
|
||||
self.assertEqual(len(index_sql), 1)
|
||||
# Ensure the index name is properly quoted
|
||||
# Ensure the index name is properly quoted.
|
||||
self.assertIn(
|
||||
connection.ops.quote_name(
|
||||
editor._create_index_name(
|
||||
Article._meta.db_table, ["headline", "pub_date"], suffix="_idx"
|
||||
)
|
||||
),
|
||||
connection.ops.quote_name(Article._meta.indexes[0].name),
|
||||
index_sql[0],
|
||||
)
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ class Article(models.Model):
|
|||
|
||||
class Meta:
|
||||
ordering = ("headline",)
|
||||
index_together = [
|
||||
["headline", "pub_date"],
|
||||
["headline", "response_to", "pub_date", "reporter"],
|
||||
indexes = [
|
||||
models.Index(fields=["headline", "pub_date"]),
|
||||
models.Index(fields=["headline", "response_to", "pub_date", "reporter"]),
|
||||
]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue