mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #24390 -- Made migration index names deterministic.
This commit is contained in:
committed by
Tim Graham
parent
4fdc7015c0
commit
f37c11eea3
@@ -10,6 +10,19 @@ class SchemaIndexesTests(TestCase):
|
||||
"""
|
||||
Test index handling by the db.backends.schema infrastructure.
|
||||
"""
|
||||
|
||||
def test_index_name_hash(self):
|
||||
"""
|
||||
Index names should be deterministic.
|
||||
"""
|
||||
with connection.schema_editor() as editor:
|
||||
index_name = editor._create_index_name(
|
||||
model=Article,
|
||||
column_names=("column1", "column2", "column3"),
|
||||
suffix="123",
|
||||
)
|
||||
self.assertEqual(index_name, "indexes_article_column1_856fe518123")
|
||||
|
||||
def test_index_together(self):
|
||||
editor = connection.schema_editor()
|
||||
index_sql = editor._model_indexes_sql(Article)
|
||||
|
||||
Reference in New Issue
Block a user