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: update error in traceability migration

Brad Barbinacfdec2fa118
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index 7aca837d60..42c9273873 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -18171,9 +18171,6 @@ export default {
{
$ref: "#/parameters/rowFilter.batchProperty.label",
},
- {
- $ref: "#/parameters/rowFilter.batchProperty.key",
- },
{
$ref: "#/parameters/rowFilter.batchProperty.dataType",
},
@@ -18266,9 +18263,6 @@ export default {
{
$ref: "#/parameters/rowFilter.batchProperty.label",
},
- {
- $ref: "#/parameters/rowFilter.batchProperty.key",
- },
{
$ref: "#/parameters/rowFilter.batchProperty.dataType",
},
@@ -18315,9 +18309,6 @@ export default {
{
$ref: "#/parameters/rowFilter.batchProperty.label",
},
- {
- $ref: "#/parameters/rowFilter.batchProperty.key",
- },
{
$ref: "#/parameters/rowFilter.batchProperty.dataType",
},
@@ -40818,6 +40809,85 @@ export default {
tags: ["(rpc) get_companies_with_permission"],
},
},
+ "/rpc/get_next_prefixed_sequence": {
+ get: {
+ parameters: [
+ {
+ format: "text",
+ in: "query",
+ name: "company_id",
+ required: true,
+ type: "string",
+ },
+ {
+ format: '"itemType"',
+ in: "query",
+ name: "item_type",
+ required: true,
+ type: "string",
+ },
+ {
+ format: "text",
+ in: "query",
+ name: "prefix",
+ required: true,
+ type: "string",
+ },
+ ],
+ produces: [
+ "application/json",
+ "application/vnd.pgrst.object+json;nulls=stripped",
+ "application/vnd.pgrst.object+json",
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ },
+ },
+ tags: ["(rpc) get_next_prefixed_sequence"],
+ },
+ post: {
+ parameters: [
+ {
+ in: "body",
+ name: "args",
+ required: true,
+ schema: {
+ properties: {
+ company_id: {
+ format: "text",
+ type: "string",
+ },
+ item_type: {
+ format: '"itemType"',
+ type: "string",
+ },
+ prefix: {
+ format: "text",
+ type: "string",
+ },
+ },
+ required: ["company_id", "item_type", "prefix"],
+ type: "object",
+ },
+ },
+ {
+ $ref: "#/parameters/preferParams",
+ },
+ ],
+ produces: [
+ "application/json",
+ "application/vnd.pgrst.object+json;nulls=stripped",
+ "application/vnd.pgrst.object+json",
+ ],
+ responses: {
+ "200": {
+ description: "OK",
+ },
+ },
+ tags: ["(rpc) get_next_prefixed_sequence"],
+ },
+ },
"/rpc/get_next_numeric_sequence": {
get: {
parameters: [
@@ -42087,6 +42157,13 @@ export default {
required: true,
type: "number",
},
+ {
+ format: "jsonb",
+ in: "query",
+ name: "p_properties",
+ required: false,
+ type: "string",
+ },
],
produces: [
"application/json",
@@ -42124,6 +42201,9 @@ export default {
format: "date",
type: "string",
},
+ p_properties: {
+ format: "jsonb",
+ },
p_quantity: {
format: "numeric",
type: "number",
@@ -52150,7 +52230,6 @@ export default {
"id",
"itemId",
"label",
- "key",
"dataType",
"sortOrder",
"companyId",
@@ -52174,10 +52253,6 @@ export default {
format: "text",
type: "string",
},
- key: {
- format: "text",
- type: "string",
- },
dataType: {
enum: ["text", "numeric", "boolean", "list"],
format: 'public."configurationParameterDataType"',
@@ -73632,13 +73707,6 @@ export default {
in: "query",
type: "string",
},
- "rowFilter.batchProperty.key": {
- name: "key",
- required: false,
- format: "text",
- in: "query",
- type: "string",
- },
"rowFilter.batchProperty.dataType": {
name: "dataType",
required: false,
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index a75cd9c326..0b16fd56cb 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -33804,6 +33804,7 @@ export type Database = {
p_manufacturing_date: string
p_expiration_date: string
p_quantity: number
+ p_properties?: Json
}
Returns: undefined
}
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index a75cd9c326..0b16fd56cb 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -33804,6 +33804,7 @@ export type Database = {
p_manufacturing_date: string
p_expiration_date: string
p_quantity: number
+ p_properties?: Json
}
Returns: undefined
}
diff --git a/packages/database/supabase/migrations/20250128094053_traceability.sql b/packages/database/supabase/migrations/20250128094053_traceability.sql
index e4236501c5..12f313c224 100644
--- a/packages/database/supabase/migrations/20250128094053_traceability.sql
+++ b/packages/database/supabase/migrations/20250128094053_traceability.sql
@@ -637,7 +637,6 @@ CREATE TABLE IF NOT EXISTS "batchProperty" (
"updatedBy" TEXT,
CONSTRAINT "batchProperty_pkey" PRIMARY KEY ("id"),
- CONSTRAINT "batchProperty_itemId_key_unique" UNIQUE ("itemId", "key"),
CONSTRAINT "batchProperty_itemId_fkey" FOREIGN KEY ("itemId") REFERENCES "item"("id") ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "batchProperty_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "company"("id") ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT "batchProperty_createdBy_fkey" FOREIGN KEY ("createdBy") REFERENCES "user"("id") ON UPDATE CASCADE,