mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #33125 -- Avoided redundant unique constraint when converting a non-unique field to primary key on MySQL and PostgreSQL.
This commit is contained in:
committed by
Mariusz Felisiak
parent
4ffada3609
commit
f5a3243911
@@ -741,6 +741,13 @@ class SchemaTests(TransactionTestCase):
|
||||
with connection.schema_editor() as editor:
|
||||
editor.remove_field(Author, Author._meta.get_field('id'))
|
||||
editor.alter_field(Author, old_field, new_field, strict=True)
|
||||
# Redundant unique constraint is not added.
|
||||
count = self.get_constraints_count(
|
||||
Author._meta.db_table,
|
||||
Author._meta.get_field('uuid').column,
|
||||
None,
|
||||
)
|
||||
self.assertLessEqual(count['uniques'], 1)
|
||||
|
||||
@isolate_apps('schema')
|
||||
def test_alter_primary_key_quoted_db_table(self):
|
||||
|
||||
Reference in New Issue
Block a user