From 9ddb69929aafd4aa3d2e1e22706f9cf5bc2b1663 Mon Sep 17 00:00:00 2001 From: Simone Cavalli Date: Sun, 17 May 2026 11:36:43 +0200 Subject: [PATCH] feat(03-01): make quote_items.service_id nullable and add custom_label column - Remove .notNull() from service_id to allow free-form items without catalog ref - Add custom_label: text("custom_label") for free-form item label storage - TypeScript compiles with zero errors (QuoteItem.service_id now string | null) --- src/db/schema.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/db/schema.ts b/src/db/schema.ts index 874fa6f..bf42a6f 100644 --- a/src/db/schema.ts +++ b/src/db/schema.ts @@ -164,11 +164,11 @@ export const quote_items = pgTable("quote_items", { .notNull() .references(() => clients.id, { onDelete: "cascade" }), service_id: text("service_id") - .notNull() - .references(() => service_catalog.id, { onDelete: "restrict" }), + .references(() => service_catalog.id, { onDelete: "restrict" }), // nullable — free-form items have no catalog ref quantity: numeric("quantity", { precision: 10, scale: 2 }).notNull(), unit_price: numeric("unit_price", { precision: 10, scale: 2 }).notNull(), // snapshot at time of quote subtotal: numeric("subtotal", { precision: 10, scale: 2 }).notNull(), + custom_label: text("custom_label"), // free-form item label (when service_id is null) }); // ============ RELATIONS ============