Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE]: NULLS (NOT) DISTINCT for Postgres Unique Indexes #3892

Open
1 task done
curiosbasant opened this issue Jan 3, 2025 · 0 comments
Open
1 task done

[FEATURE]: NULLS (NOT) DISTINCT for Postgres Unique Indexes #3892

curiosbasant opened this issue Jan 3, 2025 · 0 comments
Labels

Comments

@curiosbasant
Copy link

Feature hasn't been suggested before.

  • 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

export const userNulls = pgTable('table', {
    courseId: uuid().references(() => course.id),
    lessonId: uuid().references(() => lesson.id),
}, (t) => [{
  unq: uniqueIndex().on(t.courseId, t.lessonId).nullsNotDistinct()
}]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants