This is perfect, thanks for the explanation! Andrew > On Aug 15, 2016, at 3:55 PM, Jeremy Evans <[email protected]> wrote: > > On Monday, August 15, 2016 at 12:14:37 PM UTC-7, Andrew Burleson wrote: > On an old Stack Overflow post > <http://stackoverflow.com/questions/11442733/case-insensitive-uniqueness-validation-in-a-ruby-sequel-migration> > I found this example syntax for using constraints in a migration: > > alter_table(:table){add_unique_constraint Sequel.function(:lower, :email)} > It doesn't look like you can put a name on that constraint (in case you need > to drop it later). I searched the code here > <https://github.com/jeremyevans/sequel/blob/master/lib/sequel/extensions/migration.rb> > but couldn't find an #add_unique_constraint method, which got me wondering > where that comes from. > > So: (1) Where is that method defined in the code, and (2) is it possible to > name that constraint? > > I don't believe you can add a unique constraint on an expression (at least on > PostgreSQL), only a unique index: > > alter_table(:table){add_index Sequel.function(:lower, :email), :unique=>true, > :name=>:table_unique_email_idx} > > Thanks, > Jeremy > > -- > You received this message because you are subscribed to a topic in the Google > Groups "sequel-talk" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sequel-talk/PHMUb8Ax9YM/unsubscribe > <https://groups.google.com/d/topic/sequel-talk/PHMUb8Ax9YM/unsubscribe>. > To unsubscribe from this group and all its topics, send an email to > [email protected] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > Visit this group at https://groups.google.com/group/sequel-talk > <https://groups.google.com/group/sequel-talk>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>.
-- 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.
