diff options
author | Paveł Tyślacki <tbicr@users.noreply.github.com> | 2019-01-01 17:39:58 +0300 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2019-01-01 09:39:58 -0500 |
commit | 0123b67f6b8304a5c32a0fe98f97ae506977454b (patch) | |
tree | 42343d14292507192c1a2266544fe84562ccb74b /tests/schema | |
parent | e5ae9488acd45a9758ed5c70240a7e3fad417c00 (diff) | |
download | django-0123b67f6b8304a5c32a0fe98f97ae506977454b.tar.gz |
Fixed #30060 -- Moved SQL generation for indexes and constraints to SchemaEditor.
Diffstat (limited to 'tests/schema')
-rw-r--r-- | tests/schema/tests.py | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py index 361a5a9466..410a52b646 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -2147,23 +2147,17 @@ class SchemaTests(TransactionTestCase): editor.alter_field(model, get_field(unique=True), field, strict=True) self.assertNotIn(expected_constraint_name, self.get_constraints(model._meta.db_table)) - if editor.sql_foreign_key_constraint: + if editor.sql_create_fk: constraint_name = 'CamelCaseFKConstraint' expected_constraint_name = identifier_converter(constraint_name) - fk_sql = editor.sql_foreign_key_constraint % { - "column": editor.quote_name(column), - "to_table": editor.quote_name(table), - "to_column": editor.quote_name(model._meta.auto_field.column), - "deferrable": connection.ops.deferrable_sql(), - } - constraint_sql = editor.sql_constraint % { - "name": editor.quote_name(constraint_name), - "constraint": fk_sql, - } editor.execute( - editor.sql_create_constraint % { + editor.sql_create_fk % { "table": editor.quote_name(table), - "constraint": constraint_sql, + "name": editor.quote_name(constraint_name), + "column": editor.quote_name(column), + "to_table": editor.quote_name(table), + "to_column": editor.quote_name(model._meta.auto_field.column), + "deferrable": connection.ops.deferrable_sql(), } ) self.assertIn(expected_constraint_name, self.get_constraints(model._meta.db_table)) |