drizzle-team / drizzle-team/drizzle-orm
[FEATURE]: NULLS (NOT) DISTINCT for Postgres Unique Indexes
- Dominant language
- TypeScript
- Stars
- 35.8k
- Forks
- 1.6k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 4
Description
### Feature hasn't been suggested before.
- [X] I have verified this feature I'm about to request hasn't been suggested before.
### Describe the enhancement you want to request
A very useful new-ish feature (afaict, Postgres 15) is NULLS NOT DISTINCT in Postgres unique indexes.
https://www.postgresql.org/docs/current/indexes-unique.html
That is already supported for `unique` but not for `uniqueIndex` in `drizzle-orm`.
https://orm.drizzle.team/docs/indexes-constraints#unique
The API can definitely be same as `unique`
```ts
export const userNulls = pgTable('table', {
courseId: uuid().references(() => course.id),
lessonId: uuid().references(() => lesson.id),
}, (t) => [{
unq: uniqueIndex().on(t.courseId, t.lessonId).nullsNotDistinct()
}]);
```
Contributor guide
Assessment
This issue has not been assessed yet.