import { table, text, integer } from "@agent-native/core/db/schema"; // A poem a quote is drawn from. Kept minimal — this app curates excerpts, // not full poem texts. export const poems = table("poems", { id: integer("id").primaryKey(), author: text("author").notNull(), title: text("title").notNull(), source: text("source"), year: integer("year"), created_at: text("created_at").$defaultFn(() => new Date().toISOString()), }); // tags_json is a JSON-encoded string array (e.g. '["hope","nature"]"). // Dialect-agnostic schema helpers have no array type, so tags are // JSON-encoded text — the same convention other first-party templates use. export const quotes = table("quotes", { id: integer("id").primaryKey(), poem_id: integer("poem_id").notNull(), text: text("text").notNull(), tags_json: text("tags_json").notNull().default("[]"), is_user_submitted: integer("is_user_submitted", { mode: "boolean" }) .notNull() .default(false), created_at: text("created_at").$defaultFn(() => new Date().toISOString()), }); // visitor_id is a client-generated anonymous id (localStorage), not a real // user account — this app has no login requirement. export const favorites = table("favorites", { id: integer("id").primaryKey(), quote_id: integer("quote_id").notNull(), visitor_id: text("visitor_id").notNull(), created_at: text("created_at").$defaultFn(() => new Date().toISOString()), });