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

Fixed #32453 -- Added introspection of unique constraint field ordering on SQLite.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
This commit is contained in:
Hannes Ljungberg
2021-02-17 10:46:40 +01:00
committed by Mariusz Felisiak
parent 45bef6706a
commit 4d99375b46
3 changed files with 30 additions and 2 deletions

View File

@@ -80,3 +80,18 @@ class CheckConstraintModel(models.Model):
constraints = [
models.CheckConstraint(name='up_votes_gte_0_check', check=models.Q(up_votes__gte=0)),
]
class UniqueConstraintConditionModel(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='cond_name_without_color_uniq',
condition=models.Q(color__isnull=True),
),
]