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.

refactor: migrate existing serial numbers in attribtues to readableId column

Brad Barbin4695087c0c0f
diff --git a/packages/database/supabase/migrations/20251220021403_tracked-entity-readable-id-serial.sql b/packages/database/supabase/migrations/20251220021403_tracked-entity-readable-id-serial.sql
new file mode 100644
index 0000000000..d400be4d14
--- /dev/null
+++ b/packages/database/supabase/migrations/20251220021403_tracked-entity-readable-id-serial.sql
@@ -0,0 +1,5 @@
+UPDATE "trackedEntity"
+SET "readableId" = attributes->>'Serial Number'
+WHERE attributes ? 'Serial Number'
+ AND attributes->>'Serial Number' IS NOT NULL
+ AND attributes->>'Serial Number' != '';