mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #23013 -- Fixed removing unique_together/index_together constraints in migrations.
Thanks melinath for the report.
This commit is contained in:
parent
b65a2001e7
commit
0154965392
3 changed files with 10 additions and 4 deletions
|
@ -899,6 +899,10 @@ class OperationTests(OperationTestBase):
|
|||
operation.state_forwards("test_alunto", new_state)
|
||||
self.assertEqual(len(new_state.models["test_alunto", "pony"].options.get("unique_together", set())), 1)
|
||||
|
||||
def test_alter_unique_together_remove(self):
|
||||
operation = migrations.AlterUniqueTogether("Pony", None)
|
||||
self.assertEqual(operation.describe(), "Alter unique_together for Pony (0 constraint(s))")
|
||||
|
||||
def test_alter_index_together(self):
|
||||
"""
|
||||
Tests the AlterIndexTogether operation.
|
||||
|
@ -922,6 +926,10 @@ class OperationTests(OperationTestBase):
|
|||
operation.database_backwards("test_alinto", editor, new_state, project_state)
|
||||
self.assertIndexNotExists("test_alinto_pony", ["pink", "weight"])
|
||||
|
||||
def test_alter_index_together_remove(self):
|
||||
operation = migrations.AlterIndexTogether("Pony", None)
|
||||
self.assertEqual(operation.describe(), "Alter index_together for Pony (0 constraint(s))")
|
||||
|
||||
def test_alter_model_options(self):
|
||||
"""
|
||||
Tests the AlterModelOptions operation.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue