diff options
author | Dan Tao <daniel.tao@gmail.com> | 2019-01-18 22:17:26 -0600 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2019-01-29 15:42:57 -0500 |
commit | 738faf9da2a5cd03148a36375db80746c99c9623 (patch) | |
tree | f6b31d0e5c571693f772fe07ef224ebf5a217a98 /django/db/backends/postgresql/schema.py | |
parent | 9a0cc54524422dbdd9213e83a8ad7e8a4c13bd3e (diff) | |
download | django-738faf9da2a5cd03148a36375db80746c99c9623.tar.gz |
Fixed #30108 -- Allowed adding foreign key constraints in the same statement that adds a field.
Diffstat (limited to 'django/db/backends/postgresql/schema.py')
-rw-r--r-- | django/db/backends/postgresql/schema.py | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/django/db/backends/postgresql/schema.py b/django/db/backends/postgresql/schema.py index 9eecaac19a..2dbd9e28a1 100644 --- a/django/db/backends/postgresql/schema.py +++ b/django/db/backends/postgresql/schema.py @@ -15,6 +15,7 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor): sql_create_index = "CREATE INDEX %(name)s ON %(table)s%(using)s (%(columns)s)%(extra)s%(condition)s" sql_delete_index = "DROP INDEX IF EXISTS %(name)s" + sql_create_column_inline_fk = 'REFERENCES %(to_table)s(%(to_column)s)%(deferrable)s' # Setting the constraint to IMMEDIATE runs any deferred checks to allow # dropping it in the same transaction. sql_delete_fk = "SET CONSTRAINTS %(name)s IMMEDIATE; ALTER TABLE %(table)s DROP CONSTRAINT %(name)s" |