Drizzle TeamDT
Drizzle Team16mo ago
6 replies
Raheel

0.36.0 - The third parameter in Drizzle ORM becomes an array

Hello guys, I'm trying to setup Auth.js with Neon Postgres + Drizzle Adapter. The example given at think link: https://github.com/drizzle-team/drizzle-orm/releases/tag/0.36.0 for third param becomes an array is too basic for me to understand how do I change Auth.js schemas for accounts and sessions table to work with new version of Drizzle.

I'd very much appreciate if someone can change the following schema from object to array for third param i.e. setting up a compound primary key. Thank you.

export const accounts = pgTable(
"account",
{
userId: text("userId")
.notNull()
.references(() => users.id, { onDelete: "cascade" }),
type: text("type").$type<AdapterAccountType>().notNull(),
provider: text("provider").notNull(),
providerAccountId: text("providerAccountId").notNull(),
refresh_token: text("refresh_token"),
access_token: text("access_token"),
expires_at: integer("expires_at"),
token_type: text("token_type"),
scope: text("scope"),
id_token: text("id_token"),
session_state: text("session_state"),
},
(account) => ({
compoundKey: primaryKey({
columns: [account.provider, account.providerAccountId],
}),
})
)
GitHub
This version of drizzle-orm requires drizzle-kit@0.27.0 to enable all new features

New Features
The third parameter in Drizzle ORM becomes an array

The object API is still available but deprecate...
Release 0.36.0 · drizzle-team/drizzle-orm
Was this page helpful?