Can't figure out how to add a unique index on (foo, LOWER(bar)) for a table
Sorry chaps if this is obvious but can't seem to see any mention of this in the docs. I need to create a unique index on a tuple of columns - with the caveat that the second column is "case insensitive" - i achieve this by lowercasing the second column. I believe this is quite normal to do in vanilla pg but am unsure what the idiomatic way to do this in kysely is...
Solution:Jump to solution
Answer:
When constructing an index, you can daisy chain .column and .expression. Thus, you would do:
```typescript...
5 Replies
And then as an addendum - how do I "on conflict (foo, LOWER(bar))"
Solution
Answer:
When constructing an index, you can daisy chain .column and .expression. Thus, you would do:
That would compile to:
@Igal - I actually think this is not fully correct. It works w.r.t. creating indices, but not specifying on conflict constraints. If I do a daisy chain it only picks up the first "column" reference and ignores the expression. Is this a bug?
from the kysely playground. LMK your thoughts

Shall I create an issue on the github page?
As a workaround, one could do: