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
5 Replies
Piotrek
Piotrek16mo ago
GitHub
drizzle-orm/drizzle-orm/src/pg-core/unique-constraint.ts at 09d699f...
TypeScript ORM that feels like writing SQL. Contribute to drizzle-team/drizzle-orm development by creating an account on GitHub.
Andrii Sherman
Andrii Sherman16mo ago
not supported for now, but would be great if you can create GH feature request for that. Would gladly add a support for it
patrick
patrick13mo ago
did this ever happen?
Paul
Paul10mo ago
Any updates @Andrew Sherman , or can you tell us a way to hack this into the code so we don't have to manage some patch file?
Paul
Paul10mo ago
GitHub
[BUG]: .using() doesn't work in Postgres for add a lower() constrai...
What version of drizzle-orm are you using? 0.29.3 What version of drizzle-kit are you using? 0.20.14 Describe the Bug Trying to make a column case insensitive and unique using something like: expor...
Want results from more Discord servers?
Add your server