diff options
author | Jordan Bae <qoentlr37@naver.com> | 2021-09-25 12:59:36 +0900 |
---|---|---|
committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2021-09-28 06:20:37 +0200 |
commit | f5a3243911a5c42775cd838a3da1d0f3ac4a74ee (patch) | |
tree | ec0aea23d6f8fc96032fb2ba22e5fba58ec509e6 /tests/schema | |
parent | 4ffada36097ceccfd6f0d358217ac3c40d2a729c (diff) | |
download | django-f5a3243911a5c42775cd838a3da1d0f3ac4a74ee.tar.gz |
Fixed #33125 -- Avoided redundant unique constraint when converting a non-unique field to primary key on MySQL and PostgreSQL.
Diffstat (limited to 'tests/schema')
-rw-r--r-- | tests/schema/tests.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/schema/tests.py b/tests/schema/tests.py index 9e23c4608e..b8ad08239b 100644 --- a/tests/schema/tests.py +++ b/tests/schema/tests.py @@ -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): |