Postgresql and sqlite support it as unique index: `CREATE UNIQUE INDEX ...
WHERE condition`, for unsupported databases this constraint will not be
applied at all.
`unique_together` can be marked as deprecated in future as
`index_together` is.
--
Ticket URL: <https://code.djangoproject.com/ticket/30062>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
Old description:
> According [https://code.djangoproject.com/ticket/29641] and
> [https://code.djangoproject.com/ticket/29547] add support of conditional
> unique constraint.
>
> Postgresql and sqlite support it as unique index: `CREATE UNIQUE INDEX
> ... WHERE condition`, for unsupported databases this constraint will not
> be applied at all.
>
> `unique_together` can be marked as deprecated in future as
> `index_together` is.
New description:
According [https://code.djangoproject.com/ticket/29641] and
[https://code.djangoproject.com/ticket/29547] add support of conditional
unique constraint.
Postgresql and sqlite support it as unique index: `CREATE UNIQUE INDEX ...
WHERE condition`, for unsupported databases this constraint will not be
applied at all.
--
Comment:
I don't think deprecating `index_together` is currently planned but
[https://docs.djangoproject.com/en/2.1/ref/models/options/#index-together
the documentation do suggest it might be in the future].
I adjusted the ticket description and created #30063 so this ticket can
focus on `UniqueConstraint(condition)`.
--
Ticket URL: <https://code.djangoproject.com/ticket/30062#comment:1>
* has_patch: 1 => 0
Old description:
> According [https://code.djangoproject.com/ticket/29641] and
> [https://code.djangoproject.com/ticket/29547] add support of conditional
> unique constraint.
>
> Postgresql and sqlite support it as unique index: `CREATE UNIQUE INDEX
> ... WHERE condition`, for unsupported databases this constraint will not
> be applied at all.
New description:
According #29641 and #29547, add support of conditional unique constraint.
Postgresql and sqlite support it as unique index: `CREATE UNIQUE INDEX ...
WHERE condition`, for unsupported databases this constraint will not be
applied at all.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/30062#comment:2>
* needs_better_patch: 0 => 1
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/30062#comment:3>
* status: new => assigned
* needs_better_patch: 1 => 0
* owner: nobody => Pavel Tyslacki
--
Ticket URL: <https://code.djangoproject.com/ticket/30062#comment:4>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"b69f8eb04cc8762d3dfd5af5ea1fc58e3f2ebcc3" b69f8eb0]:
{{{
#!CommitTicketReference repository=""
revision="b69f8eb04cc8762d3dfd5af5ea1fc58e3f2ebcc3"
Fixed #30062 -- Added support for unique conditional constraints.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30062#comment:5>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"5402061c80aa2ede08a7c6b3ff204646c5059cf7" 5402061c]:
{{{
#!CommitTicketReference repository=""
revision="5402061c80aa2ede08a7c6b3ff204646c5059cf7"
Refs #30062 -- Corrected UniqueConstraint signature in docs.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30062#comment:6>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"83605a17f07e533c40e5a5367d99148bd98866b8" 83605a17]:
{{{
#!CommitTicketReference repository=""
revision="83605a17f07e533c40e5a5367d99148bd98866b8"
[2.2.x] Refs #30062 -- Corrected UniqueConstraint signature in docs.
Backport of 5402061c80aa2ede08a7c6b3ff204646c5059cf7 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/30062#comment:7>