mirror of
https://github.com/django/django.git
synced 2025-03-06 07:22:32 +00:00
Refs #26709 -- Added index name to AddIndex.describe().
This commit is contained in:
parent
7c9bd07f69
commit
a71724cd04
@ -795,7 +795,8 @@ class AddIndex(IndexOperation):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def describe(self):
|
def describe(self):
|
||||||
return 'Create index on field(s) %s of model %s' % (
|
return 'Create index %s on field(s) %s of model %s' % (
|
||||||
|
self.index.name,
|
||||||
', '.join(self.index.fields),
|
', '.join(self.index.fields),
|
||||||
self.model_name,
|
self.model_name,
|
||||||
)
|
)
|
||||||
|
@ -1405,7 +1405,7 @@ class OperationTests(OperationTestBase):
|
|||||||
migrations.AddIndex("Pony", models.Index(fields=["pink"]))
|
migrations.AddIndex("Pony", models.Index(fields=["pink"]))
|
||||||
index = models.Index(fields=["pink"], name="test_adin_pony_pink_idx")
|
index = models.Index(fields=["pink"], name="test_adin_pony_pink_idx")
|
||||||
operation = migrations.AddIndex("Pony", index)
|
operation = migrations.AddIndex("Pony", index)
|
||||||
self.assertEqual(operation.describe(), "Create index on field(s) pink of model Pony")
|
self.assertEqual(operation.describe(), "Create index test_adin_pony_pink_idx on field(s) pink of model Pony")
|
||||||
new_state = project_state.clone()
|
new_state = project_state.clone()
|
||||||
operation.state_forwards("test_adin", new_state)
|
operation.state_forwards("test_adin", new_state)
|
||||||
# Test the database alteration
|
# Test the database alteration
|
||||||
|
Loading…
x
Reference in New Issue
Block a user