summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorJosh Schneier <josh.schneier@gmail.com>2017-06-11 20:05:54 -0400
committerTim Graham <timograham@gmail.com>2017-06-22 21:31:56 -0400
commitfba0eaa5d60603721d7b4653e3efacbfb3613bd2 (patch)
tree4192e6b562aa549dbe8b67405c10b3181b43ee22 /django
parent0af14b2eaa0bf0821a8aacc8486489a1eb348397 (diff)
Fixed #28298 -- Prevented a primary key alteration from adding a foreign key constraint if db_constraint=False.
Diffstat (limited to 'django')
-rw-r--r--django/db/backends/base/schema.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py
index 91ee3dac22..c24e809570 100644
--- a/django/db/backends/base/schema.py
+++ b/django/db/backends/base/schema.py
@@ -727,7 +727,7 @@ class BaseDatabaseSchemaEditor:
# Rebuild FKs that pointed to us if we previously had to drop them
if old_field.primary_key and new_field.primary_key and old_type != new_type:
for rel in new_field.model._meta.related_objects:
- if not rel.many_to_many:
+ if not rel.many_to_many and rel.field.db_constraint:
self.execute(self._create_fk_sql(rel.related_model, rel.field, "_fk"))
# Does it have check constraints we need to add?
if old_db_params['check'] != new_db_params['check'] and new_db_params['check']: