mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #20888 -- Added support for column order in class-based indexes.
This commit is contained in:
@@ -46,6 +46,11 @@ class IndexesTests(TestCase):
|
||||
index.set_name_with_model(Book)
|
||||
self.assertEqual(index.name, 'model_index_author_0f5565_idx')
|
||||
|
||||
# '-' for DESC columns should be accounted for in the index name.
|
||||
index = models.Index(fields=['-author'])
|
||||
index.set_name_with_model(Book)
|
||||
self.assertEqual(index.name, 'model_index_author_708765_idx')
|
||||
|
||||
# fields may be truncated in the name. db_column is used for naming.
|
||||
long_field_index = models.Index(fields=['pages'])
|
||||
long_field_index.set_name_with_model(Book)
|
||||
|
||||
Reference in New Issue
Block a user