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:
|
class Meta:
|
||||||
index_together = [
|
indexes = [models.Index(fields=["headline", "pub_date"])]
|
||||||
["headline", "pub_date"],
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
class IndexedArticle(models.Model):
|
class IndexedArticle(models.Model):
|
||||||
|
|
|
@ -68,17 +68,13 @@ class SchemaIndexesTests(TestCase):
|
||||||
)
|
)
|
||||||
self.assertEqual(index_name, expected[connection.vendor])
|
self.assertEqual(index_name, expected[connection.vendor])
|
||||||
|
|
||||||
def test_index_together(self):
|
def test_quoted_index_name(self):
|
||||||
editor = connection.schema_editor()
|
editor = connection.schema_editor()
|
||||||
index_sql = [str(statement) for statement in editor._model_indexes_sql(Article)]
|
index_sql = [str(statement) for statement in editor._model_indexes_sql(Article)]
|
||||||
self.assertEqual(len(index_sql), 1)
|
self.assertEqual(len(index_sql), 1)
|
||||||
# Ensure the index name is properly quoted
|
# Ensure the index name is properly quoted.
|
||||||
self.assertIn(
|
self.assertIn(
|
||||||
connection.ops.quote_name(
|
connection.ops.quote_name(Article._meta.indexes[0].name),
|
||||||
editor._create_index_name(
|
|
||||||
Article._meta.db_table, ["headline", "pub_date"], suffix="_idx"
|
|
||||||
)
|
|
||||||
),
|
|
||||||
index_sql[0],
|
index_sql[0],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -41,9 +41,9 @@ class Article(models.Model):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ("headline",)
|
ordering = ("headline",)
|
||||||
index_together = [
|
indexes = [
|
||||||
["headline", "pub_date"],
|
models.Index(fields=["headline", "pub_date"]),
|
||||||
["headline", "response_to", "pub_date", "reporter"],
|
models.Index(fields=["headline", "response_to", "pub_date", "reporter"]),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue