1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #31351 -- Made partial constraints tests use required_db_features.

This will notably silence the warnings issued when running the test
suite on MySQL and MariaDB.
This commit is contained in:
Mariusz Felisiak
2020-04-17 07:45:52 +02:00
committed by GitHub
parent 7b31ba541f
commit 4c9886085b
2 changed files with 26 additions and 3 deletions

View File

@@ -41,6 +41,16 @@ class UniqueConstraintProduct(models.Model):
class Meta:
constraints = [
models.UniqueConstraint(fields=['name', 'color'], name='name_color_uniq'),
]
class UniqueConstraintConditionProduct(models.Model):
name = models.CharField(max_length=255)
color = models.CharField(max_length=32, null=True)
class Meta:
required_db_features = {'supports_partial_indexes'}
constraints = [
models.UniqueConstraint(
fields=['name'],
name='name_without_color_uniq',