I've been trying to figure out the syntax for a lowercase unique constraint 
on a column and so far have struck out.

I found this SO post:

http://stackoverflow.com/questions/11442733/case-insensitive-uniqueness-validation-in-a-ruby-sequel-migration

But the example there is for an `alter_table` block and I'm doing a 
`create_table`. According to the docs `unique` in create is the same thing 
as `add_unique_constraint` in alter, but if I used:

      unique Sequel.function(:lower, :username)
      unique Sequel.function(:lower, :email)

I get a syntax error:

PG::SyntaxError: ERROR:  syntax error at or near "("

LINE 1: ...min" boolean DEFAULT false NOT NULL, UNIQUE (lower("username...


In googling a bit more I see this is to be expected for postgres 
(http://shuber.io/case-insensitive-unique-constraints-in-postgres/)


That article suggests making a unique *index* instead of constraint...


What's the recommended approach to doing this with Sequel?


Thanks!

Andrew

-- 
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