Is there a way to declare a custom SQL index?

I'm trying to create an index on the lowercase value of a column using Postgres.

I tried
unique().on(sql`lower(${table.username}::text)`)
but "on" only accepts columns
Was this page helpful?