On 25 Nov 2021, at 01:11, Jesse Tayler <jtay...@oeinc.com> wrote:

> A collation would also work, I don’t think there’s a need to preserve case 
> but I guess I have thus far and perhaps that’s an easier route than 
> attempting to alter data in place, I could simply add the function in a way 
> it can blend in perhaps.

An additional option if you're using PostgreSQL (though you've hinted that 
you're not) is using the CITEXT extension type on the column:

https://www.postgresql.org/docs/13/citext.html

We've been using this on, for example, user-supplied email addresses as login 
identifiers for several years now. It lets you preserve the user-supplied case, 
but ignores it for comparisons.

> I tried to find a decent wiki page, but does anyone have good examples of 
> migrations that add constraints or do fancy stuff? 
> 
> Do I have to stuff raw SQL into a migration or are there functions I can’t 
> see in there--

You'll need to stuff raw SQL into a migration. There are several ways to do it, 
and here's one of them. In upgrade():

ERXJDBCUtilities.executeUpdate(database.adaptorChannel(), "ALTER TABLE foo ADD 
CONSTRAINT bar_unique UNIQUE (bar) DEFERRABLE INITIALLY DEFERRED;");

That's PostgreSQL syntax, and you might need to adjust it for another database.


-- 
Paul Hoadley
https://logicsquad.net/
https://www.linkedin.com/company/logic-squad/

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to