export const Recipe = pgTable("recipe", {
id: uuid("id").notNull().primaryKey().defaultRandom(),
title: varchar("title", { length: 256 }).notNull(),
description: text("description").notNull(),
mainImage: varchar("main_image", { length: 512 }),
ingredientNames: varchar("ingredient_names", { length: 255 }).array().notNull(), // Array of ingredient names
ingredientQuantities: real("ingredient_quantities").array().notNull(), // Array of ingredient quantities
ingredientUnits: varchar("ingredient_units", { length: 20 }).array().notNull(), // Array of ingredient units
stepDescriptions: text("step_descriptions").array().notNull(), // Array of step descriptions
stepImages: varchar("step_images", { length: 512 }).array().notNull(), // Array of step images
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at", {
mode: "date",
withTimezone: true,
}).$onUpdateFn(() => sql`now()`),
postedBy: uuid("posted_by").references(() => User.id, { onDelete: "cascade" }),
});
export const Recipe = pgTable("recipe", {
id: uuid("id").notNull().primaryKey().defaultRandom(),
title: varchar("title", { length: 256 }).notNull(),
description: text("description").notNull(),
mainImage: varchar("main_image", { length: 512 }),
ingredientNames: varchar("ingredient_names", { length: 255 }).array().notNull(), // Array of ingredient names
ingredientQuantities: real("ingredient_quantities").array().notNull(), // Array of ingredient quantities
ingredientUnits: varchar("ingredient_units", { length: 20 }).array().notNull(), // Array of ingredient units
stepDescriptions: text("step_descriptions").array().notNull(), // Array of step descriptions
stepImages: varchar("step_images", { length: 512 }).array().notNull(), // Array of step images
createdAt: timestamp("created_at").defaultNow().notNull(),
updatedAt: timestamp("updated_at", {
mode: "date",
withTimezone: true,
}).$onUpdateFn(() => sql`now()`),
postedBy: uuid("posted_by").references(() => User.id, { onDelete: "cascade" }),
});