import { sqliteTable, text, integer, real } from "drizzle-orm/sqlite-core"; export const categories = sqliteTable("categories", { id: integer("id").primaryKey({ autoIncrement: true }), name: text("name").notNull().unique(), emoji: text("emoji").notNull().default("\u{1F4E6}"), createdAt: integer("created_at", { mode: "timestamp" }) .notNull() .$defaultFn(() => new Date()), }); export const items = sqliteTable("items", { id: integer("id").primaryKey({ autoIncrement: true }), name: text("name").notNull(), weightGrams: real("weight_grams"), priceCents: integer("price_cents"), categoryId: integer("category_id") .notNull() .references(() => categories.id), notes: text("notes"), productUrl: text("product_url"), imageFilename: text("image_filename"), createdAt: integer("created_at", { mode: "timestamp" }) .notNull() .$defaultFn(() => new Date()), updatedAt: integer("updated_at", { mode: "timestamp" }) .notNull() .$defaultFn(() => new Date()), }); export const settings = sqliteTable("settings", { key: text("key").primaryKey(), value: text("value").notNull(), });