summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Godwin <andrew@aeracode.org>2012-09-24 13:15:08 +0100
committerAndrew Godwin <andrew@aeracode.org>2012-09-24 13:15:08 +0100
commit49dc1e7d28477534daa61a34df2f0308742287e4 (patch)
tree53391278567392c16de54433b11b48e9b25c62f1
parent0354cecbfd0cbd4e7440d56332dbb4d20f6a2fb2 (diff)
Fix altering of indexes alongside uniques
-rw-r--r--django/db/backends/schema.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/backends/schema.py b/django/db/backends/schema.py
index 09d1202aad..960fd7035d 100644
--- a/django/db/backends/schema.py
+++ b/django/db/backends/schema.py
@@ -397,7 +397,7 @@ class BaseDatabaseSchemaEditor(object):
},
)
# Removed an index?
- if old_field.db_index and not new_field.db_index and not old_field.unique and not new_field.unique:
+ if old_field.db_index and not new_field.db_index and not old_field.unique and not (not new_field.unique and old_field.unique):
# Find the index for this field
index_names = self._constraint_names(model, [old_field.column], index=True)
if strict and len(index_names) != 1:
@@ -525,7 +525,7 @@ class BaseDatabaseSchemaEditor(object):
}
)
# Added an index?
- if not old_field.db_index and new_field.db_index and not old_field.unique and not new_field.unique:
+ if not old_field.db_index and new_field.db_index and not new_field.unique and not (not old_field.unique and new_field.unique):
self.execute(
self.sql_create_index % {
"table": self.quote_name(model._meta.db_table),