Can anyone help with this issue: There is not enough information to infer relation

I defined the relationships on both sides and still no avail. anyone see anything off here, im at my last straw export const agencies = pgTable("agencies", { id: varchar("id", { length: 30 }) .$defaultFn(() => generateId("agency")) .primaryKey(), name: varchar("name", { length: 255 }).notNull(), parentId: varchar("parent_id", { length: 30 }).references( (): any => agencies.id, { onDelete: "cascade", } ), agencyLogoUrl: text("agency_logo_url"), }) export const agenciesRelations = relations(agencies, ({ one, many }) => ({ parent: one(agencies, { fields: [agencies.parentId], references: [agencies.id], relationName: "parentAgency", }), subAgencies: many(agencies, { relationName: "parentAgency", }), sidebarOptions: many(sidebarOptions, { relationName: "agency-sidebar-options", }), })) export const sidebarOptions = pgTable("sidebar_options", { id: varchar("id", { length: 30 }) .$defaultFn(() => generateId("sidebar_option")) .primaryKey(), agencyId: varchar("agency_id", { length: 30 }).references( () => agencies.id, { onDelete: "cascade", } ), name: varchar("name", { length: 255 }).notNull(), icon: varchar("icon", { length: 255 }).default("Menu").notNull(), link: text("link").default("#").notNull(), description: text("description").default(""), order: integer("order").default(1).notNull(), createdAt: timestamp("created_at").defaultNow().notNull(), updatedAt: timestamp("updated_at").default(sqlcurrent_timestamp), deletedAt: timestamp("deleted_at"), }) export const sidebarOptionsRelations = relations(sidebarOptions, ({ one }) => ({ agency: one(agencies, { fields: [sidebarOptions.agencyId], references: [agencies.id], relationName: "agency-sidebar-options", }), }))
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server