© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•3y ago•
5 replies
micaww

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)`)
unique().on(sql`lower(${table.username}::text)`)
but "on" only accepts columns
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

is there a way to use custom functions without raw sql?
Drizzle TeamDTDrizzle Team / help
16mo ago
Is there a way to define "nullable" types for magic SQL?
Drizzle TeamDTDrizzle Team / help
2y ago
Is there a way to set the index operator type for postgres?
Drizzle TeamDTDrizzle Team / help
3y ago
How to set opclass for index with custom sql column
Drizzle TeamDTDrizzle Team / help
15mo ago