dshun
dshun
PPrisma
Created by dshun on 6/6/2024 in #help-and-questions
Conditional Unique Constraint
Django offers a conditinal uniqueness constraint: Is there anything like this in prisma?
UniqueConstraint(
fields=['name', 'status'],
condition=Q(status=1),
name='unique_active_name',
]
UniqueConstraint(
fields=['name', 'status'],
condition=Q(status=1),
name='unique_active_name',
]
This is useful for the soft delete pattern, where anything that's "deleted" (but still in the DB) doesn't require the same constraints as the real active data
4 replies