Hello,
Resolved it with
add_index %i[first_name last_name],
unique: true,
where: Sequel.lit('middle_name is ?', nil)
On Thursday, January 16, 2020 at 6:27:34 PM UTC+1, Aleksandr Zykov wrote:
>
> Hello All,
>
> I need to create a unique constraint with WHERE clause. Is it possible to
> do this with Sequel?
>
> I need to do something like this, but this does not work. It creates a
> regular constraint with no WHERE.
>
> add_unique_constraint %i[first_name last_name],
> where: Sequel.lit('middle_name is ?', nil)
>
> Best Regards,
> Aleksandr
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/sequel-talk/a7c59d3a-2255-4b4a-b8c1-278318174a6a%40googlegroups.com.