mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #26593 -- Leveraged deferrable_sql() in SchemaEditor
This commit is contained in:
@@ -58,7 +58,7 @@ class BaseDatabaseSchemaEditor(object):
|
||||
|
||||
sql_create_fk = (
|
||||
"ALTER TABLE %(table)s ADD CONSTRAINT %(name)s FOREIGN KEY (%(column)s) "
|
||||
"REFERENCES %(to_table)s (%(to_column)s) DEFERRABLE INITIALLY DEFERRED"
|
||||
"REFERENCES %(to_table)s (%(to_column)s)%(deferrable)s"
|
||||
)
|
||||
sql_create_inline_fk = None
|
||||
sql_delete_fk = "ALTER TABLE %(table)s DROP CONSTRAINT %(name)s"
|
||||
@@ -889,6 +889,7 @@ class BaseDatabaseSchemaEditor(object):
|
||||
"column": self.quote_name(from_column),
|
||||
"to_table": self.quote_name(to_table),
|
||||
"to_column": self.quote_name(to_column),
|
||||
"deferrable": self.connection.ops.deferrable_sql(),
|
||||
}
|
||||
|
||||
def _create_unique_sql(self, model, columns):
|
||||
|
||||
@@ -13,10 +13,6 @@ class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
|
||||
|
||||
sql_delete_unique = "ALTER TABLE %(table)s DROP INDEX %(name)s"
|
||||
|
||||
sql_create_fk = (
|
||||
"ALTER TABLE %(table)s ADD CONSTRAINT %(name)s FOREIGN KEY "
|
||||
"(%(column)s) REFERENCES %(to_table)s (%(to_column)s)"
|
||||
)
|
||||
sql_delete_fk = "ALTER TABLE %(table)s DROP FOREIGN KEY %(name)s"
|
||||
|
||||
sql_delete_index = "DROP INDEX %(name)s ON %(table)s"
|
||||
|
||||
Reference in New Issue
Block a user