Skip to content

fix(kit): do not infer 1-1 from a partial unique index - #6146

Open
official-burak wants to merge 1 commit into
drizzle-team:betafrom
official-burak:fix/pull-ignore-partial-unique-for-one-to-one
Open

fix(kit): do not infer 1-1 from a partial unique index#6146
official-burak wants to merge 1 commit into
drizzle-team:betafrom
official-burak:fix/pull-ignore-partial-unique-for-one-to-one

Conversation

@official-burak

@official-burak official-burak commented Aug 19, 2026

Copy link
Copy Markdown

Summary

drizzle-kit pull treated UNIQUE INDEX ... WHERE ... as a full unique when deciding one-to-one vs one-to-many. A partial unique only constrains a subset of rows (e.g. one active document per user), so the parent side of that FK is still many.

This filters unique indexes that have a where predicate out of 1-1 inference for Postgres, SQLite, and Cockroach, and matches unique columns against the raw FK names so camelCase pull still sees a real full unique.

Fixes #6145

Test plan

Partial UNIQUE INDEX ... WHERE is unique only for a subset of rows, so
drizzle-kit pull should not promote the parent side of that FK to r.one.
Also match unique columns against the raw FK names so camelCase pull still
detects a true full unique.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant