summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOleg <juravel2@gmail.com>2018-09-25 23:00:20 +0300
committerTim Graham <timograham@gmail.com>2018-09-25 16:00:20 -0400
commitd1d5c97bc2821bf8c0f4b2d9c7ab16200845b494 (patch)
tree47c5e14ad793a8b02c72b9d25142d2f2f38eecda /tests
parent8624459586c7916e0a5550ed03af60afa44cf387 (diff)
Fixed #29778 -- Fixed quoting of unique index names.
Regression in 3b429c96736b8328c40e5d77282b0d30de563c3c.
Diffstat (limited to 'tests')
-rw-r--r--tests/schema/tests.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py
index f18b68d04d..245d4b0918 100644
--- a/tests/schema/tests.py
+++ b/tests/schema/tests.py
@@ -1558,6 +1558,18 @@ class SchemaTests(TransactionTestCase):
TagUniqueRename.objects.create(title="bar", slug2="foo")
Tag.objects.all().delete()
+ def test_unique_name_quoting(self):
+ old_table_name = TagUniqueRename._meta.db_table
+ try:
+ with connection.schema_editor() as editor:
+ editor.create_model(TagUniqueRename)
+ editor.alter_db_table(TagUniqueRename, old_table_name, 'unique-table')
+ TagUniqueRename._meta.db_table = 'unique-table'
+ # This fails if the unique index name isn't quoted.
+ editor.alter_unique_together(TagUniqueRename, [], (('title', 'slug2'),))
+ finally:
+ TagUniqueRename._meta.db_table = old_table_name
+
@isolate_apps('schema')
@unittest.skipIf(connection.vendor == 'sqlite', 'SQLite naively remakes the table on field alteration.')
@skipUnlessDBFeature('supports_foreign_keys')