mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #20888 -- Added support for column order in class-based indexes.
This commit is contained in:
parent
6b842c5998
commit
311a8e8d50
4 changed files with 60 additions and 6 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue