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.

feat: generate embeddings for existing records

Brad Barbinf05ec282b255
diff --git a/packages/database/supabase/migrations/20250320234334_generate-embeddings.sql b/packages/database/supabase/migrations/20250320234334_generate-embeddings.sql
new file mode 100644
index 0000000000..52ecaccf3d
--- /dev/null
+++ b/packages/database/supabase/migrations/20250320234334_generate-embeddings.sql
@@ -0,0 +1,32 @@
+
+
+-- Add existing records with null embeddings to background jobs queue
+SELECT pgmq.send(
+ 'embedding_jobs',
+ jsonb_build_object(
+ 'id', id,
+ 'table', 'item'
+ )
+)
+FROM item
+WHERE embedding IS NULL;
+
+SELECT pgmq.send(
+ 'embedding_jobs',
+ jsonb_build_object(
+ 'id', id,
+ 'table', 'supplier'
+ )
+)
+FROM supplier
+WHERE embedding IS NULL;
+
+SELECT pgmq.send(
+ 'embedding_jobs',
+ jsonb_build_object(
+ 'id', id,
+ 'table', 'customer'
+ )
+)
+FROM customer
+WHERE embedding IS NULL;