Skip to content

Commit 09d7ab5

Browse files
committed
import changes from Django 1.11.13
1 parent 212841e commit 09d7ab5

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

0 commit comments

Comments
 (0)