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
-- Ensure shelf-life policy changes are captured by the event/audit system.
-- 1) Attach event triggers for itemShelfLife.
-- 2) Backfill AUDIT subscriptions for already-audit-enabled companies.
SELECT attach_event_trigger('itemShelfLife', ARRAY[]::TEXT[], ARRAY[]::TEXT[]);
DO $$
DECLARE
company_record RECORD;
BEGIN
FOR company_record IN
SELECT id FROM "company" WHERE "auditLogEnabled" = TRUE
LOOP
INSERT INTO "eventSystemSubscription" (
"name",
"table",
"companyId",
"operations",
"handlerType",
"config",
"filter",
"active"
)
VALUES (
'audit-itemShelfLife',
'itemShelfLife',
company_record.id,
ARRAY['INSERT', 'UPDATE', 'DELETE'],
'AUDIT',
'{}'::jsonb,
'{}'::jsonb,
TRUE
)
ON CONFLICT ON CONSTRAINT "unique_subscription_name_per_company"
DO UPDATE SET
"operations" = EXCLUDED."operations",
"handlerType" = EXCLUDED."handlerType",
"config" = EXCLUDED."config",
"filter" = EXCLUDED."filter",
"active" = EXCLUDED."active";
END LOOP;
END;
$$;