|
@@ -1155,8 +1155,10 @@ class BaseDatabaseSchemaEditor:
|
|
|
return not old_field.primary_key and new_field.primary_key
|
|
|
|
|
|
def _unique_should_be_added(self, old_field, new_field):
|
|
|
- return (not old_field.unique and new_field.unique) or (
|
|
|
- old_field.primary_key and not new_field.primary_key and new_field.unique
|
|
|
+ return (
|
|
|
+ not new_field.primary_key and
|
|
|
+ new_field.unique and
|
|
|
+ (not old_field.unique or old_field.primary_key)
|
|
|
)
|
|
|
|
|
|
def _rename_field_sql(self, table, old_field, new_field, new_type):
|