Skip to content

Commit 25901e7

Browse files
committed
import changes from Django 1.11.3
1 parent f73cfaa commit 25901e7

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
@@ -350,7 +350,7 @@ def _alter_field(self, model, old_field, new_field, old_type, new_type,
350350
# Rebuild FKs that pointed to us if we previously had to drop them
351351
if old_field.primary_key and new_field.primary_key and old_type != new_type:
352352
for rel in new_field.model._meta.related_objects:
353-
if not rel.many_to_many:
353+
if not rel.many_to_many and rel.field.db_constraint:
354354
self.execute(self._create_fk_sql(rel.related_model, rel.field, "_fk"))
355355
# Does it have check constraints we need to add?
356356
if old_db_params['check'] != new_db_params['check'] and new_db_params['check']:

0 commit comments

Comments
 (0)