1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #21236 -- Allowed migrations to work with unique_together tuples.

Thanks hjwp for the report.
This commit is contained in:
Javed Khan
2013-10-07 13:07:35 +05:30
committed by Tim Graham
parent 67f5dffbec
commit 4dbd95ad65
3 changed files with 17 additions and 6 deletions

View File

@@ -267,6 +267,10 @@ class OperationTests(MigrationTestBase):
cursor.execute("INSERT INTO test_alunto_pony (id, pink, weight) VALUES (1, 1, 1)")
cursor.execute("INSERT INTO test_alunto_pony (id, pink, weight) VALUES (2, 1, 1)")
cursor.execute("DELETE FROM test_alunto_pony")
# Test flat unique_together
operation = migrations.AlterUniqueTogether("Pony", ("pink", "weight"))
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_index_together(self):
"""