Skip to content

Commit 79fcbf3

Browse files
committed
Merge branch 'azure-1.11' into azure-2.0
2 parents 75cc66d + 09d7ab5 commit 79fcbf3

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
@@ -403,7 +403,7 @@ def _alter_field(self, model, old_field, new_field, old_type, new_type,
403403
# Rebuild FKs that pointed to us if we previously had to drop them
404404
if drop_foreign_keys:
405405
for rel in new_field.model._meta.related_objects:
406-
if not rel.many_to_many and rel.field.db_constraint:
406+
if _is_relevant_relation(rel, new_field) and rel.field.db_constraint:
407407
self.execute(self._create_fk_sql(rel.related_model, rel.field, "_fk"))
408408
# Does it have check constraints we need to add?
409409
if (old_db_params['check'] != new_db_params['check'] and new_db_params['check']) or (

0 commit comments

Comments
 (0)