diff options
| author | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-08-01 09:21:07 +0200 |
|---|---|---|
| committer | Sarah Boyce <42296566+sarahboyce@users.noreply.github.com> | 2024-08-01 09:25:33 +0200 |
| commit | 3dac3271d286f2790780e89d31ddbb7197f8defa (patch) | |
| tree | 79c692137c241e587c82dea21e3d76b2afe320d6 /django/db/backends/base/schema.py | |
| parent | 8cf931dd2fde2561a615b96d5f709c15b672c4ba (diff) | |
Reverted "Fixed #28646 -- Prevented duplicate index when unique is set to True on PostgreSQL."
This reverts commit 9cf9c796be8dd53bc3b11355ff39d65c81d7be6d due to a crash on Oracle
as it didn't allow multiple indexes on the same field.
Diffstat (limited to 'django/db/backends/base/schema.py')
| -rw-r--r-- | django/db/backends/base/schema.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py index f6b675339a..3e38c56d50 100644 --- a/django/db/backends/base/schema.py +++ b/django/db/backends/base/schema.py @@ -964,7 +964,9 @@ class BaseDatabaseSchemaEditor: fks_dropped.add((old_field.column,)) self.execute(self._delete_fk_sql(model, fk_name)) # Has unique been removed? - if old_field.unique and not old_field.primary_key and not new_field.unique: + if old_field.unique and ( + not new_field.unique or self._field_became_primary_key(old_field, new_field) + ): # Find the unique constraint for this field meta_constraint_names = { constraint.name for constraint in model._meta.constraints |
