mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #29778 -- Fixed quoting of unique index names.
Regression in 3b429c9673
.
This commit is contained in:
parent
8624459586
commit
d1d5c97bc2
3 changed files with 18 additions and 1 deletions
|
@ -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')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue