Skip to content

Commit 329c431

Browse files
committed
Merge branch 'lecchri1-fix-alter-field-constraint-remove' into azure-1.11
2 parents 10da334 + f45970f commit 329c431

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sql_server/pyodbc/schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _alter_field(self, model, old_field, new_field, old_type, new_type,
6868
fks_dropped = set()
6969
if old_field.remote_field and old_field.db_constraint:
7070
# Drop index, SQL Server requires explicit deletion
71-
if not new_field.db_constraint:
71+
if not hasattr(new_field, 'db_constraint') or not new_field.db_constraint:
7272
index_names = self._constraint_names(model, [old_field.column], index=True)
7373
for index_name in index_names:
7474
self.execute(self._delete_constraint_sql(self.sql_delete_index, model, index_name))

0 commit comments

Comments
 (0)