sqldiff shows wrong constraint?
Author: BoPengCreated Apr 26, 2023Updated Jul 23, 2026
I have a model with
class AttachmentManager:
class Meta:
constraints = [
models.UniqueConstraint(
fields=['workflow'], condition=Q(is_primary=True), name='unique primary attachment')
]when I run sqldiff on this module, it shows
ALTER TABLE "workflows_attachmentmanager" ADD CONSTRAINT "workflows_attachmentmanager_workflow_id_c003521f_uniq" UNIQUE ("workflow_id");It looks like the suggested constraint is wrong because it does not consider the condition, right?
Source: django-extensions/django-extensions