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: purchasing RFQ notes column type

Sidwebworks54f22b21a49d
diff --git a/packages/database/supabase/migrations/20260622195346_purchasing-rfq-internal-notes-json.sql b/packages/database/supabase/migrations/20260622195346_purchasing-rfq-internal-notes-json.sql
new file mode 100644
index 0000000000..f6b3b2f7bf
--- /dev/null
+++ b/packages/database/supabase/migrations/20260622195346_purchasing-rfq-internal-notes-json.sql
@@ -0,0 +1,13 @@
+-- "purchasingRfq"."internalNotes" was created as TEXT, unlike every other entity
+-- (purchaseOrder, supplierQuote, quote, purchasingRfqLine) where it is JSON. The
+-- rich-text Editor writes a JSONContent object, so the TEXT column stored a JSON
+-- string that the loader handed back to the Editor unparsed, rendering raw JSON.
+-- Align the column type with the rest of the codebase.
+
+ALTER TABLE "purchasingRfq"
+ ALTER COLUMN "internalNotes" TYPE JSON USING
+ CASE
+ WHEN "internalNotes" IS NULL OR "internalNotes" = '' THEN '{}'::JSON
+ ELSE "internalNotes"::JSON
+ END,
+ ALTER COLUMN "internalNotes" SET DEFAULT '{}';