diff options
author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2019-08-26 09:15:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-26 09:15:37 +0200 |
commit | 579909a13feb958f75d1d77e9995cef8f2b9c2a3 (patch) | |
tree | 8dd959ba3727b3d2b40b8b5631ccd73d190048d7 /tests/introspection | |
parent | d0861fcb2dbb2e733a189115b546651a5042a327 (diff) | |
download | django-579909a13feb958f75d1d77e9995cef8f2b9c2a3.tar.gz |
Refs #30591 -- Fixed introspection of check and unique column constraints on MariaDB.
Unnamed unique and check columns constraints have the same name as
a column. Ensure uniqueness by using custom names.
Thanks Adnan Umer for the report.
Diffstat (limited to 'tests/introspection')
-rw-r--r-- | tests/introspection/models.py | 1 | ||||
-rw-r--r-- | tests/introspection/tests.py | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/tests/introspection/models.py b/tests/introspection/models.py index 6f43359dd4..c3f6338176 100644 --- a/tests/introspection/models.py +++ b/tests/introspection/models.py @@ -83,6 +83,7 @@ class Comment(models.Model): class CheckConstraintModel(models.Model): up_votes = models.PositiveIntegerField() + voting_number = models.PositiveIntegerField(unique=True) class Meta: required_db_features = { diff --git a/tests/introspection/tests.py b/tests/introspection/tests.py index 91b6ec732e..5e6fd3d741 100644 --- a/tests/introspection/tests.py +++ b/tests/introspection/tests.py @@ -268,9 +268,15 @@ class IntrospectionTests(TransactionTestCase): elif details['columns'] == ['up_votes'] and details['check']: assertDetails(details, ['up_votes'], check=True) field_constraints.add(name) + elif details['columns'] == ['voting_number'] and details['check']: + assertDetails(details, ['voting_number'], check=True) + field_constraints.add(name) elif details['columns'] == ['ref'] and details['unique']: assertDetails(details, ['ref'], unique=True) field_constraints.add(name) + elif details['columns'] == ['voting_number'] and details['unique']: + assertDetails(details, ['voting_number'], unique=True) + field_constraints.add(name) elif details['columns'] == ['article_id'] and details['index']: assertDetails(details, ['article_id'], index=True) field_constraints.add(name) |