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

Outdated example syntax in Constraint docs #435

Open
man-bug opened this issue Nov 20, 2024 · 1 comment
Open

Outdated example syntax in Constraint docs #435

man-bug opened this issue Nov 20, 2024 · 1 comment

Comments

@man-bug
Copy link

man-bug commented Nov 20, 2024

https://orm.drizzle.team/docs/indexes-constraints

The examples in the docs for table constraints (unique, check, etc) show an object return syntax for the extraConfig callback:

export const userNulls = pgTable('user_nulls_example', {
  id: integer('id').unique("custom_name", { nulls: 'not distinct' }),
}, (t) => ({
  unq: unique().on(t.id).nullsNotDistinct()
}));

looks like that syntax was deprecated by a commit for RLS about a month ago & now it expects an array return:

export const userNulls = pgTable('user_nulls_example', {
  id: integer('id').unique("custom_name", { nulls: 'not distinct' }),
}, (t) => [
  unique().on(t.id).nullsNotDistinct()
]);

would also be helpful to add a note or something for this change since it's breaking from how constraints used to work in drizzle

thanks!

@zomchak-code
Copy link

#466

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

No branches or pull requests

2 participants