drizzle-team / drizzle-orm-docs

Drizzle ORM documentation website
https://orm.drizzle.team
144 stars 233 forks source link

Outdated example syntax in Constraint docs #435

Open man-bug opened 2 weeks ago

man-bug commented 2 weeks ago

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!