mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
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.
This commit is contained in:
parent
d0861fcb2d
commit
579909a13f
3 changed files with 16 additions and 1 deletions
|
@ -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 = {
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue