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: migration for cost ledger migration

Brad Barbin0154a5907a65
diff --git a/packages/database/supabase/migrations/20250116182231_shipping-cost-on-purchase-order.sql b/packages/database/supabase/migrations/20250116182231_shipping-cost-on-purchase-order.sql
index 4866833d05..90bb81b6c1 100644
--- a/packages/database/supabase/migrations/20250116182231_shipping-cost-on-purchase-order.sql
+++ b/packages/database/supabase/migrations/20250116182231_shipping-cost-on-purchase-order.sql
@@ -1,12 +1,12 @@
ALTER TABLE "purchaseOrderDelivery"
ADD COLUMN IF NOT EXISTS "supplierShippingCost" NUMERIC NOT NULL DEFAULT 0;
-ALTER TABLE "costLedger" RENAME COLUMN "costPostedToGL" TO "nominalCost";
-ALTER TABLE "costLedger" ADD COLUMN "supplierId" TEXT REFERENCES "supplier" ("id");
-ALTER TABLE "costLedger" DROP COLUMN "itemReadableId";
+ALTER TABLE "costLedger" RENAME COLUMN IF EXISTS "costPostedToGL" TO "nominalCost";
+ALTER TABLE "costLedger" ADD COLUMN IF NOT EXISTS "supplierId" TEXT REFERENCES "supplier" ("id");
+ALTER TABLE "costLedger" DROP COLUMN IF EXISTS "itemReadableId";
INSERT INTO "customFieldTable" ("table", "name", "module")
-VALUES ('purchaseInvoiceDelivery', 'Purchase Invoice Delivery', 'Purchase Orders');
+VALUES ('purchaseInvoiceDelivery', 'Purchase Invoice Delivery', 'Invoicing');
CREATE TABLE "purchaseInvoiceDelivery" (
"id" TEXT NOT NULL,