1
0
mirror of https://github.com/django/django.git synced 2025-10-27 23:56:08 +00:00

Fixed #29496 -- Fixed crash on Oracle when converting a non-unique field to primary key.

Thanks Tim Graham for the review.
This commit is contained in:
Mariusz Felisiak
2018-06-17 08:51:02 +02:00
committed by GitHub
parent e95008f241
commit 6dd4edb1b4
4 changed files with 32 additions and 6 deletions

View File

@@ -144,6 +144,12 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
return False
return create_index
def _unique_should_be_added(self, old_field, new_field):
return (
super()._unique_should_be_added(old_field, new_field) and
not self._field_became_primary_key(old_field, new_field)
)
def _is_identity_column(self, table_name, column_name):
with self.connection.cursor() as cursor:
cursor.execute("""