1
0
mirror of https://github.com/django/django.git synced 2025-10-30 17:16:10 +00:00

[3.2.x] Fixed #32453 -- Added introspection of unique constraint field ordering on SQLite.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>

Backport of 4d99375b46 from master
This commit is contained in:
Hannes Ljungberg
2021-02-17 10:46:40 +01:00
committed by Mariusz Felisiak
parent b89ce413f2
commit 69a585eb87
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),
),
]