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
fix: bug with rls
Brad Barbin9efe204ee928
diff --git a/packages/database/supabase/migrations/20251212233918_external-links.sql b/packages/database/supabase/migrations/20251212233918_external-links.sqlnew file mode 100644index 0000000000..eadccfa719--- /dev/null+++ b/packages/database/supabase/migrations/20251212233918_external-links.sql@@ -0,0 +1,59 @@+DROP POLICY "Authenticated users can view external links" ON "externalLink";+DROP POLICY "Employees with purchasing_create can insert purchasing-related external links" ON "externalLink";+DROP POLICY "Employees with purchasing_update can update purchasing-related external links" ON "externalLink";+DROP POLICY "Employees with purchasing_delete can delete purchasing-related external links" ON "externalLink";++CREATE POLICY "SELECT" ON "externalLink"+ FOR SELECT+ USING (+ "companyId" = ANY (+ (+ SELECT+ get_companies_with_employee_role()+ )::text[]+ )+ );++CREATE POLICY "INSERT" ON "externalLink"+ FOR INSERT+ WITH CHECK (+ "companyId" = ANY (+ SELECT DISTINCT unnest(ARRAY(+ SELECT unnest(get_companies_with_employee_permission('sales_create'))+ UNION+ SELECT unnest(get_companies_with_employee_permission('purchasing_create'))+ UNION+ SELECT unnest(get_companies_with_employee_permission('quality_create'))+ ))+ )+ );++CREATE POLICY "UPDATE" ON "externalLink"+ FOR UPDATE USING (+ "companyId" = ANY (+ (+ SELECT DISTINCT unnest(ARRAY(+ SELECT unnest(get_companies_with_employee_permission('sales_update'))+ UNION+ SELECT unnest(get_companies_with_employee_permission('purchasing_update'))+ UNION+ SELECT unnest(get_companies_with_employee_permission('quality_update'))+ ))+ )+ )+ );++CREATE POLICY "DELETE" ON "externalLink"+ FOR DELETE USING (+ "companyId" = ANY (+ (+ SELECT DISTINCT unnest(ARRAY(+ SELECT unnest(get_companies_with_employee_permission('sales_delete'))+ UNION+ SELECT unnest(get_companies_with_employee_permission('purchasing_delete'))+ UNION+ SELECT unnest(get_companies_with_employee_permission('quality_delete'))+ ))+ )+ )+ );\ No newline at end of file