Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
add some changes
Gaurav Bhatt5445015716d1
diff --git a/apps/erp/app/modules/shared/imports.models.ts b/apps/erp/app/modules/shared/imports.models.tsindex 624481c3e2..f68fba5a7d 100644--- a/apps/erp/app/modules/shared/imports.models.ts+++ b/apps/erp/app/modules/shared/imports.models.ts@@ -83,6 +83,11 @@ const supplierPartImportFields = {required: false,type: "string"},+ orderMultiple: {+ label: "Order Multiple",+ required: false,+ type: "string"+ },conversionFactor: {label: "Conversion Factor",required: false,@@ -95,6 +100,19 @@ const supplierPartImportFields = {}} as const;+// Item-level purchasing fields. Spread into every real item-type entry+// (part / material / tool / fixture / consumable). These write to the+// item's "itemReplenishment" row (auto-created by the create_item_related_records+// trigger) in the edge function's post-pass — the same fields the in-app+// "Purchasing" tab edits.+const itemPurchasingImportFields = {+ leadTime: {+ label: "Lead Time (Days)",+ required: false,+ type: "string"+ }+} as const;+// Shared address + payment + incoterm fields. Spread into supplier and// customer entries — they write to side-tables (supplierLocation/address +// supplierPayment + supplierShipping; same for customer) in the edge@@ -591,7 +609,8 @@ export const fieldMappings = {default: "EA"}},- ...supplierPartImportFields+ ...supplierPartImportFields,+ ...itemPurchasingImportFields},tool: {id: {@@ -681,7 +700,8 @@ export const fieldMappings = {default: "EA"}},- ...supplierPartImportFields+ ...supplierPartImportFields,+ ...itemPurchasingImportFields},fixture: {id: {@@ -771,7 +791,8 @@ export const fieldMappings = {default: "EA"}},- ...supplierPartImportFields+ ...supplierPartImportFields,+ ...itemPurchasingImportFields},consumable: {id: {@@ -861,7 +882,8 @@ export const fieldMappings = {default: "EA"}},- ...supplierPartImportFields+ ...supplierPartImportFields,+ ...itemPurchasingImportFields},material: {id: {@@ -993,7 +1015,8 @@ export const fieldMappings = {default: "EA"}},- ...supplierPartImportFields+ ...supplierPartImportFields,+ ...itemPurchasingImportFields},methodMaterial: {level: {@@ -1485,8 +1508,10 @@ export const importSchemas: Record<supplierPartId: z.string().optional(),supplierUnitOfMeasureCode: z.string().optional(),minimumOrderQuantity: z.string().optional(),+ orderMultiple: z.string().optional(),conversionFactor: z.string().optional(),- unitPrice: z.string().optional()+ unitPrice: z.string().optional(),+ leadTime: z.string().optional()}),tool: z.object({id: z@@ -1526,8 +1551,10 @@ export const importSchemas: Record<supplierPartId: z.string().optional(),supplierUnitOfMeasureCode: z.string().optional(),minimumOrderQuantity: z.string().optional(),+ orderMultiple: z.string().optional(),conversionFactor: z.string().optional(),- unitPrice: z.string().optional()+ unitPrice: z.string().optional(),+ leadTime: z.string().optional()}),fixture: z.object({id: z@@ -1567,8 +1594,10 @@ export const importSchemas: Record<supplierPartId: z.string().optional(),supplierUnitOfMeasureCode: z.string().optional(),minimumOrderQuantity: z.string().optional(),+ orderMultiple: z.string().optional(),conversionFactor: z.string().optional(),- unitPrice: z.string().optional()+ unitPrice: z.string().optional(),+ leadTime: z.string().optional()}),consumable: z.object({id: z@@ -1608,8 +1637,10 @@ export const importSchemas: Record<supplierPartId: z.string().optional(),supplierUnitOfMeasureCode: z.string().optional(),minimumOrderQuantity: z.string().optional(),+ orderMultiple: z.string().optional(),conversionFactor: z.string().optional(),- unitPrice: z.string().optional()+ unitPrice: z.string().optional(),+ leadTime: z.string().optional()}),material: z.object({id: z@@ -1656,8 +1687,10 @@ export const importSchemas: Record<supplierPartId: z.string().optional(),supplierUnitOfMeasureCode: z.string().optional(),minimumOrderQuantity: z.string().optional(),+ orderMultiple: z.string().optional(),conversionFactor: z.string().optional(),- unitPrice: z.string().optional()+ unitPrice: z.string().optional(),+ leadTime: z.string().optional()}),methodMaterial: z.object({level: z.string().optional().describe("The level of the material"),diff --git a/llm/tasks/todo.md b/llm/tasks/todo.mdindex f8d2457e18..75146a5008 100644--- a/llm/tasks/todo.md+++ b/llm/tasks/todo.md@@ -1,219 +1,32 @@-# MTO Shipment COGS Recognition--> **For agentic workers:** Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.--**Goal:** Make MTO (Make-to-Order) shipment posting recognize COGS from the job by routing MTO jobs through `complete_job_to_inventory()` and removing the `continue` statements that skip GL/inventory posting in `post-shipment`.--**Architecture:** Unify MTO and MTS job completion paths so both call `complete_job_to_inventory()`. This creates cost layers in `costLedger` and itemLedger entries for the finished good. Then remove the `continue` statements in `post-shipment/index.ts` so MTO shipment lines go through the same COGS/inventory posting as regular lines.--**Tech Stack:** PostgreSQL (PL/pgSQL migrations), TypeScript (Deno edge functions)-------### Task 1: New migration — unify `sync_finish_job_operation` for MTO and MTS--**Files:**-- Create: `packages/database/supabase/migrations/20260512120000_mto-shipment-cogs.sql`--The current `sync_finish_job_operation` trigger (defined in `20260511120000_backflush-job-materials.sql:860-935`) branches on `v_sales_order_id IS NOT NULL`. MTO jobs only call `backflush_job_materials()`, while MTS jobs call `complete_job_to_inventory()` (which internally calls `backflush_job_materials()`). We need MTO to also call `complete_job_to_inventory()`.--- [ ] **Step 1: Write the migration**--```sql--- Unify MTO and MTS job completion: both now call complete_job_to_inventory--- Previously, MTO jobs only called backflush_job_materials(), skipping--- cost layer creation. This meant shipment posting had no cost layers--- to consume for COGS.--CREATE OR REPLACE FUNCTION sync_finish_job_operation(- p_new JSONB,- p_old JSONB,- p_operation TEXT-)-RETURNS VOID-LANGUAGE plpgsql-SECURITY DEFINER-SET search_path = public-AS $$-DECLARE- v_job_location_id TEXT;- v_job_storage_unit_id TEXT;- v_job_quantity NUMERIC;- v_sales_order_id TEXT;- v_quantity_complete NUMERIC;- v_job_status TEXT;-BEGIN- IF p_operation != 'UPDATE' THEN RETURN; END IF;- IF (p_new->>'status') != 'Done' OR (p_old->>'status') = 'Done' THEN RETURN; END IF;-- -- Close all open production events for this operation- UPDATE "productionEvent"- SET "endTime" = NOW()- WHERE "jobOperationId" = p_new->>'id'- AND "endTime" IS NULL;-- -- Unlock dependent operations whose dependencies are now all done- UPDATE "jobOperation" op- SET status = 'Ready'- WHERE EXISTS (- SELECT 1- FROM "jobOperationDependency" dep- WHERE dep."operationId" = op.id- AND dep."dependsOnId" = p_new->>'id'- AND op.status = 'Waiting'- )- AND NOT EXISTS (- SELECT 1- FROM "jobOperationDependency" dep2- JOIN "jobOperation" jo2 ON jo2.id = dep2."dependsOnId"- WHERE dep2."operationId" = op.id- AND jo2.status != 'Done'- AND jo2.id != p_new->>'id'- );-- -- Only complete the job if it is in an active state (has been released/started)- SELECT status INTO v_job_status FROM "job" WHERE id = p_new->>'jobId';- IF v_job_status NOT IN ('Ready', 'In Progress', 'Paused') THEN- RETURN;- END IF;-- -- If this is the last operation, mark the job as Completed- IF is_last_job_operation(p_new->>'id') THEN- SELECT "locationId", "storageUnitId", quantity, "salesOrderId"- INTO v_job_location_id, v_job_storage_unit_id, v_job_quantity, v_sales_order_id- FROM "job"- WHERE id = p_new->>'jobId';-- v_quantity_complete := CASE- WHEN COALESCE((p_new->>'quantityComplete')::NUMERIC, 0) = 0 THEN v_job_quantity- ELSE (p_new->>'quantityComplete')::NUMERIC- END;-- PERFORM complete_job_to_inventory(- p_job_id := p_new->>'jobId',- p_quantity_complete := v_quantity_complete,- p_storage_unit_id := v_job_storage_unit_id,- p_location_id := v_job_location_id,- p_company_id := p_new->>'companyId',- p_user_id := p_new->>'updatedBy'- );- END IF;-END;-$$;-```--- [ ] **Step 2: Verify migration syntax**--Run: `cd /Users/barbinbrad/Code/carbon && grep -c "CREATE OR REPLACE FUNCTION sync_finish_job_operation" packages/database/supabase/migrations/20260512120000_mto-shipment-cogs.sql`-Expected: `1`--- [ ] **Step 3: Commit**--```bash-git add packages/database/supabase/migrations/20260512120000_mto-shipment-cogs.sql-git commit -m "feat: unify MTO/MTS job completion to both call complete_job_to_inventory--Previously MTO jobs only called backflush_job_materials(), skipping cost-layer creation in costLedger. This meant shipment posting had no cost-layers to consume for COGS recognition.--Co-Authored-By: Claude Opus 4.6 <[email protected]>"-```-------### Task 2: Remove `continue` in post-shipment posting flow--**Files:**-- Modify: `packages/database/supabase/functions/post-shipment/index.ts:322`--The `continue` on line 322 causes MTO shipment lines (fulfillment type "Job") to skip all downstream processing: itemLedger creation, COGS journal entries, cost layer consumption. After Task 1, MTO finished goods will have proper cost layers, so we can let them flow through the normal COGS path.--- [ ] **Step 1: Remove the `continue` statement**--In `packages/database/supabase/functions/post-shipment/index.ts`, delete line 322 (`continue;`). The job update block (lines 215-321) should still run, but then fall through to the itemLedger/COGS code below instead of skipping it.--The change is deleting this single line:-```typescript- // BEFORE (line 322):- continue;-```--After the closing brace of the job update block on line 321 (`}`), the code should fall through to line 325 (`const itemTrackingType = ...`).--- [ ] **Step 2: Verify the change**--Run: `grep -n "continue;" packages/database/supabase/functions/post-shipment/index.ts | head -5`--The `continue` that was on line 322 should no longer appear in the posting section (lines 210-460). There may still be a `continue` in the void section — that's Task 3.--- [ ] **Step 3: Commit**--```bash-git add packages/database/supabase/functions/post-shipment/index.ts-git commit -m "feat: enable COGS posting for MTO shipment lines--Remove continue statement that skipped itemLedger, COGS journal entries,-and cost layer consumption for job-fulfilled shipment lines.--Co-Authored-By: Claude Opus 4.6 <[email protected]>"-```-------### Task 3: Remove `continue` in post-shipment void flow--**Files:**-- Modify: `packages/database/supabase/functions/post-shipment/index.ts:1753`--The void flow has the same issue: MTO shipment lines skip inventory restoration and COGS reversal journal entries.--- [ ] **Step 1: Remove the `continue` statement in the void section**--In `packages/database/supabase/functions/post-shipment/index.ts`, delete the `continue;` on line 1753 (this line number may have shifted by -1 after Task 2). It's inside the void flow's job update block, after `jobUpdates[jobId] = { ... }` on line 1747-1751.--The change is deleting this single line:-```typescript- // BEFORE (line 1753, or 1752 after Task 2):- continue;-```--After removing it, the void flow will fall through to create positive adjustment itemLedger entries (restoring inventory), batch/serial tracking restoration, and COGS reversal journal entries for MTO lines.--- [ ] **Step 2: Verify the change**--Run: `grep -n "continue;" packages/database/supabase/functions/post-shipment/index.ts`--There should be no `continue` statements remaining inside either the post or void shipment line loops related to job fulfillment.--- [ ] **Step 3: Commit**--```bash-git add packages/database/supabase/functions/post-shipment/index.ts-git commit -m "feat: enable COGS reversal for voided MTO shipments--Remove continue statement that skipped inventory restoration and COGS-reversal journal entries for job-fulfilled shipment lines during void.--Co-Authored-By: Claude Opus 4.6 <[email protected]>"-```-----+# Task: Add purchasing import fields (order multiple, supplier MOQ, purchasing lead time)++Spawn subtasks to query the cache folder any time I need to learn something about the codebase. NEVER update the cache with plans or information about code that is not yet committed.++## Interpretation of the three requested fields+- **Supplier order multiple** → `supplierPart.orderMultiple` — column does NOT exist; add to schema + import + edge-function write.+- **Supplier MOQ** → `supplierPart.minimumOrderQuantity` — ALREADY an import field ("Minimum Order Quantity"). No change; confirm to user.+- **Purchasing lead time** → `itemReplenishment.purchasingLeadTime` (item-level "Purchasing" tab). New import field + new edge-function UPDATE path (itemReplenishment is auto-created by `create_item_related_records` AFTER INSERT trigger, default 0; we UPDATE it post-insert).++## Steps+- [ ] Migration `20260526160000_supplier-part-order-multiple.sql`: `ALTER TABLE "supplierPart" ADD COLUMN IF NOT EXISTS "orderMultiple" INTEGER DEFAULT 1;` (mirrors nullable `minimumOrderQuantity`).+- [ ] `imports.models.ts`: add `orderMultiple` to `supplierPartImportFields`; add `itemPurchasingImportFields` const with `leadTime`; spread into part/tool/fixture/consumable/material; add `orderMultiple` + `leadTime` to those 5 `importSchemas` Zod objects.+- [ ] `import-csv/index.ts`:+ - `SupplierPartImportLink` + `supplierPartForInserts` type: add `orderMultiple?`.+ - both `supplierPartLinks.push` sites + the inserts push: carry `orderMultiple`.+ - `writeSupplierPartLinks`: parse + write `orderMultiple` (null when absent, like MOQ).+ - new `writeItemPurchasingLeadTimes` helper (UPDATE itemReplenishment); collect entries for inserts (parallel array) + updates; call after item upserts.+- [ ] Spread `...itemPurchasingImportFields` only on the 5 real item types (NOT methodMaterial / workCenter / etc).++## Notes / decisions+- Column name `orderMultiple` matches existing `itemPlanning.orderMultiple` convention.+- NOT touching SupplierPartForm/validator (explicit scope = schema + import). `sanitize()` on update protects imported value from being nulled by a later form save. Form field is a 1-line follow-up if wanted.+- types.ts cannot be regenerated by me (DB rebuild is the user's job) — typecheck will show transient errors on `supplierPart.orderMultiple` until the user rebuilds + regenerates types. Flag this.## Review--After all three tasks, verify:--- [ ] `sync_finish_job_operation` no longer branches on `salesOrderId` — both MTO and MTS call `complete_job_to_inventory()`-- [ ] `complete_job_to_inventory()` calls `backflush_job_materials()` internally (line 513 of 20260511 migration), so no double-backflush-- [ ] Post-shipment posting flow: MTO lines create itemLedger entries, COGS journal entries, and consume cost layers-- [ ] Post-shipment void flow: MTO lines create reversal itemLedger entries and COGS reversal journal entries-- [ ] Job quantity tracking (quantityShipped, quantityComplete, status) still works — that code runs before the removed `continue`--## Notes--- Migration file: `packages/database/supabase/migrations/20260512120000_mto-shipment-cogs.sql`-- Edge function: `packages/database/supabase/functions/post-shipment/index.ts`-- `complete_job_to_inventory` is defined in `20260511120000_backflush-job-materials.sql:342-837`-- `backflush_job_materials` is defined in `20260511120000_backflush-job-materials.sql:1-340`-- `calculateCOGS` is at `packages/database/supabase/functions/shared/calculate-cogs.ts`+- [x] Migration `20260526160000_supplier-part-order-multiple.sql` — adds nullable `orderMultiple INTEGER DEFAULT 1`.+- [x] `imports.models.ts` — `orderMultiple` in supplierPartImportFields; new `itemPurchasingImportFields` (`leadTime`) spread into the 5 item types (NOT methodMaterial); `orderMultiple` + `leadTime` added to the 5 item importSchemas. Verified 5 literal spreads, 5 schema additions each.+- [x] `import-csv/index.ts` — `SupplierPartImportLink.orderMultiple`, `ItemPurchasingLeadTime` type, `writeItemPurchasingLeadTimes` helper (UPDATE itemReplenishment), orderMultiple written in writeSupplierPartLinks (set+values), lead time collected for inserts (parallel array) + updates, both helpers called in txn.+- [x] erp typecheck: clean (exit 0). database tsgo: clean (edge fn is Deno, out of tsgo scope).+- **Supplier MOQ already existed** as import field "Minimum Order Quantity" — no change made.+- **Pending (user action):** rebuild DB + regenerate types so `supplierPart.orderMultiple` lands in the generated `Database` type. Until then the Deno typecheck of import-csv will flag `orderMultiple`. NEVER rebuild DB myself.+- Did NOT add `orderMultiple` to SupplierPartForm/validator (explicit scope was schema + import; `sanitize()` protects the imported value from form saves). 1-line follow-up if visibility wanted.diff --git a/packages/database/supabase/functions/import-csv/index.ts b/packages/database/supabase/functions/import-csv/index.tsindex c91c3a271e..b02328b42d 100644--- a/packages/database/supabase/functions/import-csv/index.ts+++ b/packages/database/supabase/functions/import-csv/index.ts@@ -580,10 +580,16 @@ type SupplierPartImportLink = {supplierPartId?: string;supplierUnitOfMeasureCode?: string;minimumOrderQuantity?: string;+ orderMultiple?: string;conversionFactor?: string;unitPrice?: string;};+type ItemPurchasingLeadTime = {+ itemId: string;+ leadTime: string;+};+async function writeSupplierPartLinks(trx: typeof db,links: SupplierPartImportLink[],@@ -611,6 +617,9 @@ async function writeSupplierPartLinks(const numericMOQ = link.minimumOrderQuantity? Number.parseInt(link.minimumOrderQuantity, 10): null;+ const numericOrderMultiple = link.orderMultiple+ ? Number.parseInt(link.orderMultiple, 10)+ : null;const numericConversion = link.conversionFactor? Number.parseFloat(link.conversionFactor): 1;@@ -625,6 +634,7 @@ async function writeSupplierPartLinks(supplierPartId: link.supplierPartId || null,supplierUnitOfMeasureCode: link.supplierUnitOfMeasureCode || null,minimumOrderQuantity: numericMOQ,+ orderMultiple: numericOrderMultiple,conversionFactor: numericConversion,unitPrice: numericPrice,updatedAt: now,@@ -641,6 +651,7 @@ async function writeSupplierPartLinks(supplierPartId: link.supplierPartId || null,supplierUnitOfMeasureCode: link.supplierUnitOfMeasureCode || null,minimumOrderQuantity: numericMOQ,+ orderMultiple: numericOrderMultiple,conversionFactor: numericConversion,unitPrice: numericPrice,companyId,@@ -651,6 +662,35 @@ async function writeSupplierPartLinks(}}+// Set the item-level purchasing lead time (the "Purchasing" tab field).+// The itemReplenishment row is created by the create_item_related_records+// AFTER INSERT trigger on item (default purchasingLeadTime 0), so within this+// transaction the row already exists for every item we just upserted — we only+// need to UPDATE it.+async function writeItemPurchasingLeadTimes(+ trx: typeof db,+ entries: ItemPurchasingLeadTime[],+ companyId: string,+ userId: string+): Promise<void> {+ if (entries.length === 0) return;+ const now = new Date().toISOString();+ for (const entry of entries) {+ const numericLeadTime = Number.parseInt(entry.leadTime, 10);+ if (Number.isNaN(numericLeadTime)) continue;+ await trx+ .updateTable("itemReplenishment")+ .set({+ purchasingLeadTime: numericLeadTime,+ updatedAt: now,+ updatedBy: userId,+ })+ .where("itemId", "=", entry.itemId)+ .where("companyId", "=", companyId)+ .execute();+ }+}+async function upsertTaxIdentifiers(trx: typeof db,table: "customerTax" | "supplierTax",@@ -1233,10 +1273,17 @@ serve(async (req: Request) => {supplierPartId?: string;supplierUnitOfMeasureCode?: string;minimumOrderQuantity?: string;+ orderMultiple?: string;conversionFactor?: string;unitPrice?: string;}> = [];const supplierPartLinks: SupplierPartImportLink[] = [];+ // Item-level purchasing lead times. leadTimeForInserts is parallel to+ // itemInserts (filled in the insert branch); purchasingLeadTimes+ // collects the final {itemId, leadTime} entries once item ids are+ // known (immediately for updates, post-insert for new items).+ const leadTimeForInserts: Array<string | undefined> = [];+ const purchasingLeadTimes: ItemPurchasingLeadTime[] = [];const itemValidator = z.object({id: z.string(),@@ -1311,11 +1358,19 @@ serve(async (req: Request) => {supplierPartId: record.supplierPartId,supplierUnitOfMeasureCode: record.supplierUnitOfMeasureCode,minimumOrderQuantity: record.minimumOrderQuantity,+ orderMultiple: record.orderMultiple,conversionFactor: record.conversionFactor,unitPrice: record.unitPrice,});}+ if (record.leadTime) {+ purchasingLeadTimes.push({+ itemId: existingEntityId,+ leadTime: record.leadTime,+ });+ }+if (table === "material") {const material = materialValidator.safeParse(record);if (material.success) {@@ -1359,16 +1414,18 @@ serve(async (req: Request) => {itemInserts.push(newItem);csvIdsForInserts.push(getExternalId(id));// New item: id will come back from the bulk insert. Capture- // supplier-part data in a parallel array so we can build the- // link once the id is known.+ // supplier-part data and lead time in parallel arrays so we can+ // build the link / lead-time entry once the id is known.supplierPartForInserts.push({supplierId: record.supplierId,supplierPartId: record.supplierPartId,supplierUnitOfMeasureCode: record.supplierUnitOfMeasureCode,minimumOrderQuantity: record.minimumOrderQuantity,+ orderMultiple: record.orderMultiple,conversionFactor: record.conversionFactor,unitPrice: record.unitPrice,});+ leadTimeForInserts.push(record.leadTime);if (table === "material") {const material = materialValidator.safeParse(record);@@ -1467,9 +1524,10 @@ serve(async (req: Request) => {.execute();}- // Build supplier-part links for the items we just inserted.- // supplierPartForInserts is parallel to itemInserts and only the- // rows where supplierId is set produce a link.+ // Build supplier-part links and lead-time entries for the items we+ // just inserted. supplierPartForInserts / leadTimeForInserts are+ // parallel to itemInserts; only rows with a supplier produce a+ // link, only rows with a lead time produce a lead-time entry.for (let i = 0; i < insertedItems.length; i++) {const sp = supplierPartForInserts[i];if (sp?.supplierId && insertedItems[i].id) {@@ -1479,10 +1537,18 @@ serve(async (req: Request) => {supplierPartId: sp.supplierPartId,supplierUnitOfMeasureCode: sp.supplierUnitOfMeasureCode,minimumOrderQuantity: sp.minimumOrderQuantity,+ orderMultiple: sp.orderMultiple,conversionFactor: sp.conversionFactor,unitPrice: sp.unitPrice,});}+ const leadTime = leadTimeForInserts[i];+ if (leadTime && insertedItems[i].id) {+ purchasingLeadTimes.push({+ itemId: insertedItems[i].id!,+ leadTime,+ });+ }}}@@ -1552,6 +1618,13 @@ serve(async (req: Request) => {companyId,userId);++ await writeItemPurchasingLeadTimes(+ trx,+ purchasingLeadTimes,+ companyId,+ userId+ );});break;diff --git a/packages/database/supabase/migrations/20260526160000_supplier-part-order-multiple.sql b/packages/database/supabase/migrations/20260526160000_supplier-part-order-multiple.sqlnew file mode 100644index 0000000000..dd6a040dd7--- /dev/null+++ b/packages/database/supabase/migrations/20260526160000_supplier-part-order-multiple.sql@@ -0,0 +1,6 @@+-- Supplier order multiple: the pack/case quantity a supplier requires you to+-- order in (e.g., order in multiples of 25). Mirrors the nullable+-- "minimumOrderQuantity" column already on supplierPart, and matches the+-- "orderMultiple" naming used on itemPlanning.+ALTER TABLE "supplierPart"+ ADD COLUMN IF NOT EXISTS "orderMultiple" INTEGER DEFAULT 1;