summaryrefslogtreecommitdiff
path: root/tests/indexes
diff options
context:
space:
mode:
authorDan Tao <daniel.tao@gmail.com>2019-01-18 22:17:26 -0600
committerTim Graham <timograham@gmail.com>2019-01-29 15:42:57 -0500
commit738faf9da2a5cd03148a36375db80746c99c9623 (patch)
treef6b31d0e5c571693f772fe07ef224ebf5a217a98 /tests/indexes
parent9a0cc54524422dbdd9213e83a8ad7e8a4c13bd3e (diff)
downloaddjango-738faf9da2a5cd03148a36375db80746c99c9623.tar.gz
Fixed #30108 -- Allowed adding foreign key constraints in the same statement that adds a field.
Diffstat (limited to 'tests/indexes')
-rw-r--r--tests/indexes/tests.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/tests/indexes/tests.py b/tests/indexes/tests.py
index 7eb5dd89a9..ecc449ed4a 100644
--- a/tests/indexes/tests.py
+++ b/tests/indexes/tests.py
@@ -226,11 +226,9 @@ class SchemaIndexesMySQLTests(TransactionTestCase):
new_field.set_attributes_from_name('new_foreign_key')
editor.add_field(ArticleTranslation, new_field)
field_created = True
- self.assertEqual([str(statement) for statement in editor.deferred_sql], [
- 'ALTER TABLE `indexes_articletranslation` '
- 'ADD CONSTRAINT `indexes_articletrans_new_foreign_key_id_d27a9146_fk_indexes_a` '
- 'FOREIGN KEY (`new_foreign_key_id`) REFERENCES `indexes_article` (`id`)'
- ])
+ # No deferred SQL. The FK constraint is included in the
+ # statement to add the field.
+ self.assertFalse(editor.deferred_sql)
finally:
if field_created:
with connection.schema_editor() as editor: