From 4c1c6a340781e04c95dc7c1fd5ef5c71383348b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20M?= Date: Wed, 22 Nov 2023 14:58:13 +0100 Subject: [PATCH] fix: can't create fields of type UUID (#2642) --- .../convert-field-metadata-to-column-action.util.ts | 13 +++++++++++++ .../utils/generate-target-column-map.util.ts | 1 + 2 files changed, 14 insertions(+) diff --git a/server/src/metadata/field-metadata/utils/convert-field-metadata-to-column-action.util.ts b/server/src/metadata/field-metadata/utils/convert-field-metadata-to-column-action.util.ts index 62f6a9ca9a..d519903f04 100644 --- a/server/src/metadata/field-metadata/utils/convert-field-metadata-to-column-action.util.ts +++ b/server/src/metadata/field-metadata/utils/convert-field-metadata-to-column-action.util.ts @@ -14,6 +14,19 @@ export function convertFieldMetadataToColumnActions( fieldMetadata: FieldMetadataEntity, ): WorkspaceMigrationColumnAction[] { switch (fieldMetadata.type) { + case FieldMetadataType.UUID: { + const defaultValue = + fieldMetadata.defaultValue as FieldMetadataDefaultValue; + + return [ + { + action: WorkspaceMigrationColumnActionType.CREATE, + columnName: fieldMetadata.targetColumnMap.value, + columnType: 'uuid', + defaultValue: serializeDefaultValue(defaultValue?.value), + }, + ]; + } case FieldMetadataType.TEXT: { const defaultValue = fieldMetadata.defaultValue as FieldMetadataDefaultValue; diff --git a/server/src/metadata/field-metadata/utils/generate-target-column-map.util.ts b/server/src/metadata/field-metadata/utils/generate-target-column-map.util.ts index 8b3f99df2c..083a2d3fb8 100644 --- a/server/src/metadata/field-metadata/utils/generate-target-column-map.util.ts +++ b/server/src/metadata/field-metadata/utils/generate-target-column-map.util.ts @@ -19,6 +19,7 @@ export function generateTargetColumnMap( const columnName = isCustomField ? `_${fieldName}` : fieldName; switch (type) { + case FieldMetadataType.UUID: case FieldMetadataType.TEXT: case FieldMetadataType.PHONE: case FieldMetadataType.EMAIL: