Skip to content

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.

fix: upsert part for onshape sync

Brad Barbin71944e3081bc
diff --git a/packages/database/supabase/functions/sync/index.ts b/packages/database/supabase/functions/sync/index.ts
index 6e78c91538..32b33d7d97 100644
--- a/packages/database/supabase/functions/sync/index.ts
+++ b/packages/database/supabase/functions/sync/index.ts
@@ -212,6 +212,12 @@ serve(async (req: Request) => {
companyId,
createdBy: userId,
})
+ .onConflict((oc) =>
+ oc.columns(["id", "companyId"]).doUpdateSet({
+ updatedBy: userId,
+ updatedAt: new Date().toISOString(),
+ })
+ )
.execute();
// Store the newly created item to avoid duplicate inserts