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)
This commit is contained in:
+2
-2
@@ -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 ============
|
||||
|
||||
Reference in New Issue
Block a user