Unique Constraint in Drizzle
Coming from Prisma, I am trying to have a unique constraint on a column. Anyone know how to do this?
It says it is yet to be implemented in the docs, but I honestly don't know how Drizzle would be a viable alternative to Prisma without being able to set things like unique columns in a table.
4 Replies
Indexes & Constraints – DrizzleORM
Drizzle ORM | %s
Thanks! I think that is going to work. When it says drizzle kit only supports index
name
and on()
param, what does that mean?
You're welcome! That probably means that drizzle doesn't support the NULLS/NOT/DISTINCT paramenters here: https://www.postgresql.org/docs/current/indexes-unique.html
PostgreSQL Documentation
11.6. Unique Indexes
11.6. Unique Indexes Indexes can also be used to enforce uniqueness of a column's value, or the uniqueness of the combined …
I would recommend asking this in their discord as theyre super helpful to people that have problems or questions about drizzle!