From 2e8941b6f90e65ffad3f07083b8de59e8ed29767 Mon Sep 17 00:00:00 2001 From: Simon Charette Date: Tue, 23 Jun 2020 23:43:22 -0400 Subject: Fixed #31735 -- Fixed migrations crash on namespaced inline FK addition on PostgreSQL. The namespace of the constraint must be included when making the constraint immediate. Regression in 22ce5d0031bd795ade081394043833e82046016c. Thanks Rodrigo Estevao for the report. --- django/db/backends/postgresql/schema.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'django/db/backends/postgresql/schema.py') diff --git a/django/db/backends/postgresql/schema.py b/django/db/backends/postgresql/schema.py index fbc4a59dc4..7687c37fe7 100644 --- a/django/db/backends/postgresql/schema.py +++ b/django/db/backends/postgresql/schema.py @@ -27,7 +27,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): # transaction. sql_create_column_inline_fk = ( 'CONSTRAINT %(name)s REFERENCES %(to_table)s(%(to_column)s)%(deferrable)s' - '; SET CONSTRAINTS %(name)s IMMEDIATE' + '; SET CONSTRAINTS %(namespace)s%(name)s IMMEDIATE' ) # Setting the constraint to IMMEDIATE runs any deferred checks to allow # dropping it in the same transaction. -- cgit v1.2.1