indexes with pgTable deprecated

Using drizzle-orm: 0.36.0 I followed the docs creating indexes: https://orm.drizzle.team/docs/indexes-constraints#indexes--constraints However i'm getting a warning concerning a deprecated use of pgTable. Here's my code:
export const steps = pgTable(
"steps",
{
id: uuid("id").primaryKey().defaultRandom(),
//...
createdAt: timestamp("created_at", defaultTimestampOpts).defaultNow().notNull(),
updatedAt: timestamp("updated_at", defaultTimestampOpts).defaultNow().notNull(),
},
(table) => ({
stepsGuideIdIndex: index("...").on(table.<..>),
}),
);
export const steps = pgTable(
"steps",
{
id: uuid("id").primaryKey().defaultRandom(),
//...
createdAt: timestamp("created_at", defaultTimestampOpts).defaultNow().notNull(),
updatedAt: timestamp("updated_at", defaultTimestampOpts).defaultNow().notNull(),
},
(table) => ({
stepsGuideIdIndex: index("...").on(table.<..>),
}),
);
Drizzle ORM - Indexes & Constraints
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
4 Replies
Angelelz
Angelelz5w ago
the docs need an update the third parameter as an object has been deprecated
Angelelz
Angelelz5w ago
GitHub
Release 0.36.0 · drizzle-team/drizzle-orm
This version of drizzle-orm requires [email protected] to enable all new features New Features The third parameter in Drizzle ORM becomes an array The object API is still available but deprecate...
nakofum
nakofumOP5w ago
thanks!
Raheel
Raheel5w ago
Any update on this? I need to change the accounts and sessions table schemas from Auth.js to work with the Drizzle 0.36.0 and above. Drizzle docs still show the old way to define primary keys with objects instead of array. Thanks
Want results from more Discord servers?
Add your server