Skip to content

Database diagrams editor that allows you to visualize and design your DB with a single query.

fix multi space type

Guy Ben-Aharon970265b41198
diff --git a/src/context/storage-context/storage-provider.tsx b/src/context/storage-context/storage-provider.tsx
index f1534957..f33193b0 100644
--- a/src/context/storage-context/storage-provider.tsx
+++ b/src/context/storage-context/storage-provider.tsx
@@ -46,7 +46,7 @@ export const StorageProvider: React.FC<React.PropsWithChildren> = ({
for (const field of table.fields) {
field.type = {
// @ts-expect-error string before
- id: (field.type as string).replace(' ', '_'),
+ id: (field.type as string).split(' ').join('_'),
// @ts-expect-error string before
name: field.type,
};
diff --git a/src/lib/data/data-types.ts b/src/lib/data/data-types.ts
index a08cd992..56771128 100644
--- a/src/lib/data/data-types.ts
+++ b/src/lib/data/data-types.ts
@@ -57,11 +57,11 @@ export const postgresDataTypes: readonly DataType[] = [
// Date/Time Types
{ name: 'date', id: 'date' },
{ name: 'timestamp', id: 'timestamp' },
- { name: 'timestamp with time zone', id: 'timestamp_with time zone' },
- { name: 'timestamp without time zone', id: 'timestamp_without time zone' },
+ { name: 'timestamp with time zone', id: 'timestamp_with_time_zone' },
+ { name: 'timestamp without time zone', id: 'timestamp_without_time_zone' },
{ name: 'time', id: 'time' },
- { name: 'time with time zone', id: 'time_with time zone' },
- { name: 'time without time zone', id: 'time_without time zone' },
+ { name: 'time with time zone', id: 'time_with_time_zone' },
+ { name: 'time without time zone', id: 'time_without_time_zone' },
{ name: 'interval', id: 'interval' },
// Boolean Type
diff --git a/src/lib/domain/db-table.ts b/src/lib/domain/db-table.ts
index ac059b63..cd0c45e0 100644
--- a/src/lib/domain/db-table.ts
+++ b/src/lib/domain/db-table.ts
@@ -66,7 +66,7 @@ export const createTablesFromMetadata = ({
(col: ColumnInfo): DBField => ({
id: generateId(),
name: col.name,
- type: { id: col.type.replace(' ', '_'), name: col.type },
+ type: { id: col.type.split(' ').join('_'), name: col.type },
primaryKey: tablePrimaryKeys.some(
(pk) => pk.column === col.name
),