export const category = pgTable('categories', {
id: serial('id').primaryKey().notNull(),
parentCategoryId: integer('parent_category_id').references((): AnyPgColumn => category.id)
});
// relation
export const categoryRelations = relations(category, ({ many, one }) => ({
categories: many(category),
parentCategory: one(category, {
fields: [category.parentCategoryId],
references: [category.id]
})
}));
export const category = pgTable('categories', {
id: serial('id').primaryKey().notNull(),
parentCategoryId: integer('parent_category_id').references((): AnyPgColumn => category.id)
});
// relation
export const categoryRelations = relations(category, ({ many, one }) => ({
categories: many(category),
parentCategory: one(category, {
fields: [category.parentCategoryId],
references: [category.id]
})
}));