Following the docs to create a many to many relation it suggests to create a junction or join table. The ts deprecation error is below.
@deprecated — This overload is deprecated. Use the other method overload instead.
The suggested code is as follows:
export const usersToGroups = pgTable(
'users_to_groups',
{
userId: integer('user_id')
.notNull()
.references(() => users.id),
groupId: integer('group_id')
.notNull()
.references(() => groups.id),
},
(t) => ({
pk: primaryKey({ columns: [t.userId, t.groupId] }),
}),
);
The error occurs when trying to generate the primary key.
I followed all the docs looking for a suggestion. I tried delving into the generated types to find the error too.
When there's no explanation on docs, release note is where we should go.
Check this out: https://github.com/drizzle-team/drizzle-orm/releases/tag/0.36.0