summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLászló Károlyi <laszlo@karolyi.hu>2015-02-25 19:48:35 +0100
committerTim Graham <timograham@gmail.com>2015-03-02 09:25:19 -0500
commitf37c11eea3cb860112a26f8a65d823842f65b96f (patch)
treea752ed51a15ee4ab5c78f5a92328e5c209431e4d /tests
parent4fdc7015c0d0849e391aa22da46b62a8fa4de27c (diff)
Fixed #24390 -- Made migration index names deterministic.
Diffstat (limited to 'tests')
-rw-r--r--tests/indexes/tests.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/indexes/tests.py b/tests/indexes/tests.py
index 95de0a2963..749d6081fc 100644
--- a/tests/indexes/tests.py
+++ b/tests/indexes/tests.py
@@ -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)