On Tuesday, June 21, 2016 at 11:38:37 PM UTC-7, The Bang Nguyen wrote:
>
> Hi Jeremy,
>
> I remember that I did googling and find the way to use `self.|` in 
> `add_constraint`.
>
> For example:
> alter_table(:table) do
>         add_constraint(:constraint) { self.|(:status => [1, 2, 3]) }
>     end
> end
>
> Which will generate the constraint on status column of the table in which 
> status can only be 1,2 or 3.
>
> I try to find the document again in sequel documentation, however, there's 
> no luck.
> If you can, could you please point me the way to find such documentation.
>
 
 
http://sequel.jeremyevans.net/rdoc/files/doc/virtual_rows_rdoc.html#label-Boolean+Operators
 

> Is there the other way to generate such constraint which is more readable? 
> I found that it is a bit verbose though.
>

  add_constraint(:constraint, :status => [1, 2, 3])

There's no reason to use self.| with one argument, since all it does is put 
the OR between the arguments given.

Thanks,
Jeremy

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to