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: remove symbol column from currencyCode table

Rob Carringtonf73d38cfbbb6
diff --git a/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable.tsx b/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable.tsx
index fb2565c5bd..7af748771a 100644
--- a/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable.tsx
+++ b/apps/carbon/app/modules/accounting/ui/Currencies/CurrenciesTable.tsx
@@ -36,10 +36,6 @@ const CurrenciesTable = memo(({ data, count }: CurrenciesTableProps) => {
header: "Code",
cell: (item) => item.getValue(),
},
- {
- header: "Symbol",
- cell: ({ row }) => row.original.symbol,
- },
{
accessorKey: "exchangeRate",
header: "Exchange Rate",
diff --git a/apps/carbon/app/modules/accounting/ui/Currencies/CurrencyForm.tsx b/apps/carbon/app/modules/accounting/ui/Currencies/CurrencyForm.tsx
index 5e19b92ef9..c56dba4fb0 100644
--- a/apps/carbon/app/modules/accounting/ui/Currencies/CurrencyForm.tsx
+++ b/apps/carbon/app/modules/accounting/ui/Currencies/CurrencyForm.tsx
@@ -74,7 +74,6 @@ const CurrencyForm = ({ initialValues }: CurrencyFormProps) => {
<VStack spacing={4}>
<Input name="name" label="Name" isReadOnly />
<Input name="code" label="Code" isReadOnly />
- <Input name="symbol" label="Symbol" isReadOnly />
<Number
name="decimalPlaces"
label="Decimal Places"
diff --git a/packages/database/src/swagger-docs-schema.ts b/packages/database/src/swagger-docs-schema.ts
index eb78068f8c..a0b09073e2 100644
--- a/packages/database/src/swagger-docs-schema.ts
+++ b/packages/database/src/swagger-docs-schema.ts
@@ -3489,9 +3489,6 @@ export default {
{
$ref: "#/parameters/rowFilter.currencyCode.name",
},
- {
- $ref: "#/parameters/rowFilter.currencyCode.symbol",
- },
{
$ref: "#/parameters/select",
},
@@ -3557,9 +3554,6 @@ export default {
{
$ref: "#/parameters/rowFilter.currencyCode.name",
},
- {
- $ref: "#/parameters/rowFilter.currencyCode.symbol",
- },
{
$ref: "#/parameters/preferReturn",
},
@@ -3579,9 +3573,6 @@ export default {
{
$ref: "#/parameters/rowFilter.currencyCode.name",
},
- {
- $ref: "#/parameters/rowFilter.currencyCode.symbol",
- },
{
$ref: "#/parameters/body.currencyCode",
},
@@ -7779,9 +7770,6 @@ export default {
{
$ref: "#/parameters/rowFilter.currencies.name",
},
- {
- $ref: "#/parameters/rowFilter.currencies.symbol",
- },
{
$ref: "#/parameters/select",
},
@@ -37288,7 +37276,7 @@ export default {
type: "object",
},
currencyCode: {
- required: ["code", "name", "symbol"],
+ required: ["code", "name"],
properties: {
code: {
description: "Note:\nThis is a Primary Key.<pk/>",
@@ -37299,10 +37287,6 @@ export default {
format: "text",
type: "string",
},
- symbol: {
- format: "text",
- type: "string",
- },
},
type: "object",
},
@@ -39444,10 +39428,6 @@ export default {
format: "text",
type: "string",
},
- symbol: {
- format: "text",
- type: "string",
- },
},
type: "object",
},
@@ -53270,13 +53250,6 @@ export default {
in: "query",
type: "string",
},
- "rowFilter.currencyCode.symbol": {
- name: "symbol",
- required: false,
- format: "text",
- in: "query",
- type: "string",
- },
"body.methodMaterial": {
name: "methodMaterial",
description: "methodMaterial",
@@ -55959,13 +55932,6 @@ export default {
in: "query",
type: "string",
},
- "rowFilter.currencies.symbol": {
- name: "symbol",
- required: false,
- format: "text",
- in: "query",
- type: "string",
- },
"body.shift": {
name: "shift",
description: "shift",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 3966065cb1..61a276208e 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -2779,17 +2779,14 @@ export type Database = {
Row: {
code: string
name: string
- symbol: string
}
Insert: {
code: string
name: string
- symbol: string
}
Update: {
code?: string
name?: string
- symbol?: string
}
Relationships: []
}
@@ -22732,7 +22729,6 @@ export type Database = {
exchangeRate: number | null
id: string | null
name: string | null
- symbol: string | null
updatedAt: string | null
updatedBy: string | null
}
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 3966065cb1..61a276208e 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -2779,17 +2779,14 @@ export type Database = {
Row: {
code: string
name: string
- symbol: string
}
Insert: {
code: string
name: string
- symbol: string
}
Update: {
code?: string
name?: string
- symbol?: string
}
Relationships: []
}
@@ -22732,7 +22729,6 @@ export type Database = {
exchangeRate: number | null
id: string | null
name: string | null
- symbol: string | null
updatedAt: string | null
updatedBy: string | null
}
diff --git a/packages/database/supabase/migrations/20241008201834_remove-currency-symbol-column.sql b/packages/database/supabase/migrations/20241008201834_remove-currency-symbol-column.sql
new file mode 100644
index 0000000000..40294637dd
--- /dev/null
+++ b/packages/database/supabase/migrations/20241008201834_remove-currency-symbol-column.sql
@@ -0,0 +1,10 @@
+DROP VIEW IF EXISTS "currencies";
+
+ALTER TABLE "currencyCode" DROP COLUMN "symbol";
+
+-- Create a currencies view with all of the columns from the currency table, joined with the currencyCode table
+CREATE OR REPLACE VIEW "currencies" WITH(SECURITY_INVOKER=true) AS
+ SELECT c.*, cc."name"
+ FROM "currency" c
+ INNER JOIN "currencyCode" cc
+ ON cc."code" = c."code";
\ No newline at end of file