summaryrefslogtreecommitdiff
path: root/django/db
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2013-07-02 11:25:18 +0100
committerAndrew Godwin <andrew@aeracode.org>2013-07-02 11:25:18 +0100
commit3b20af3e96b45fd3cfd9beb74bd09f65b4e38aa8 (patch)
tree1c2dd996884c4464c4d577bdb054c774d0ced960 /django/db
parent67dcea711e92025d0e8676b869b7ef15dbc6db73 (diff)
Autodetection of unique_together changes
Diffstat (limited to 'django/db')
-rw-r--r--django/db/migrations/autodetector.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py
index bb065e99bf..d524f96a0b 100644
--- a/django/db/migrations/autodetector.py
+++ b/django/db/migrations/autodetector.py
@@ -191,6 +191,15 @@ class MigrationAutodetector(object):
field = new_model_state.get_field_by_name(field_name),
)
)
+ # unique_together changes
+ if old_model_state.options.get("unique_together", set()) != new_model_state.options.get("unique_together", set()):
+ self.add_to_migration(
+ app_label,
+ operations.AlterUniqueTogether(
+ name = model_name,
+ unique_together = new_model_state.options.get("unique_together", set()),
+ )
+ )
# Alright, now add internal dependencies
for app_label, migrations in self.migrations.items():
for m1, m2 in zip(migrations, migrations[1:]):