diff options
| author | Markus Holtermann <info@markusholtermann.eu> | 2017-04-07 17:47:53 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2017-04-07 11:48:25 -0400 |
| commit | f9d2a20d7b6cbef24199332d28534e3e16fa20d9 (patch) | |
| tree | d86b75e4454e73cf5da8dbf420237b77cad5b4d2 /tests | |
| parent | 0cb009aa488f4c66d2b434bf3df13e719b2e2fc6 (diff) | |
[1.11.x] Fixed #28051 -- Made migrations respect Index's name argument.
Thanks Marc Tamlyn for the report and Tim Graham for the review.
Backport of d3cf75ec6fbdd2c1f1bb1e6ccb48d4de1da2952b from master
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/migrations/test_state.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py index 68c3b98391..c929df3182 100644 --- a/tests/migrations/test_state.py +++ b/tests/migrations/test_state.py @@ -1071,6 +1071,19 @@ class ModelStateTests(SimpleTestCase): child1_state.options['indexes'][0].name = 'bar' self.assertEqual(Child1._meta.indexes[0].name, 'migrations__name_b0afd7_idx') + @isolate_apps('migrations') + def test_explicit_index_name(self): + class TestModel(models.Model): + name = models.CharField(max_length=50) + + class Meta: + app_label = 'migrations' + indexes = [models.indexes.Index(fields=['name'], name='foo_idx')] + + model_state = ModelState.from_model(TestModel) + index_names = [index.name for index in model_state.options['indexes']] + self.assertEqual(index_names, ['foo_idx']) + class RelatedModelsTests(SimpleTestCase): |
