Foreign Key, is this method deprecated?

facing a lot of problems using this syntax, somebody can help me? import { foreignKey, index, pgTable, primaryKey, text, timestamp, uuid, } from "drizzle-orm/pg-core"; export const profiles = pgTable("profiles", { id: uuid("id").primaryKey().notNull(), username: text("username").notNull().unique(), createAt: timestamp("created_at").defaultNow().notNull(), }); export const posts = pgTable( "posts", { id: uuid("id").primaryKey().notNull().defaultRandom(), profileId: uuid("profile_id") .notNull() .references(() => profiles.id), parentId: uuid("parent_id"), content: text("content").notNull(), createAt: timestamp("created_at").defaultNow().notNull(), }, (table) => ({ parentReference: foreignKey({ columns: [table.parentId], foreignColumns: [table.id], name: "post_parent_id_fkey", }), createdAtIdx: index("posts_created_at_idx").on(table.createAt), profileIdIdx: index("posts_profile_id_idx").on(table.profileId), parentIdIdx: index("posts_parent_id_idx").on(table.parentId), }) );
2 Replies
Angelelz
Angelelz3w ago
In the latest release they deprecated that api in favor of an array https://github.com/drizzle-team/drizzle-orm/releases/tag/0.36.0
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...
mattvalgreen
mattvalgreenOP3w ago
Thank you so much, @Angelelz
Want results from more Discord servers?
Add your server