From 6556a41a5a58551512fb26b6a3ea6391040b1a54 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 27 Apr 2022 16:29:03 +0100 Subject: [PATCH] Fix for #5219 - default all string types to basic text format, allow user to switch string types to longform if they desire. --- packages/builder/src/constants/backend/index.js | 6 +++++- packages/server/src/constants/index.js | 6 +++++- packages/server/src/integrations/utils.ts | 6 +++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/constants/backend/index.js b/packages/builder/src/constants/backend/index.js index 2f5f26e476..922955591a 100644 --- a/packages/builder/src/constants/backend/index.js +++ b/packages/builder/src/constants/backend/index.js @@ -144,7 +144,11 @@ export const RelationshipTypes = { MANY_TO_ONE: "many-to-one", } -export const ALLOWABLE_STRING_OPTIONS = [FIELDS.STRING, FIELDS.OPTIONS] +export const ALLOWABLE_STRING_OPTIONS = [ + FIELDS.STRING, + FIELDS.OPTIONS, + FIELDS.LONGFORM, +] export const ALLOWABLE_STRING_TYPES = ALLOWABLE_STRING_OPTIONS.map( opt => opt.type ) diff --git a/packages/server/src/constants/index.js b/packages/server/src/constants/index.js index 0d52eecb5b..60f3c981d6 100644 --- a/packages/server/src/constants/index.js +++ b/packages/server/src/constants/index.js @@ -47,7 +47,11 @@ exports.FieldTypes = { exports.CanSwitchTypes = [ [exports.FieldTypes.JSON, exports.FieldTypes.ARRAY], - [exports.FieldTypes.STRING, exports.FieldTypes.OPTIONS], + [ + exports.FieldTypes.STRING, + exports.FieldTypes.OPTIONS, + exports.FieldTypes.LONGFORM, + ], [exports.FieldTypes.BOOLEAN, exports.FieldTypes.NUMBER], ] diff --git a/packages/server/src/integrations/utils.ts b/packages/server/src/integrations/utils.ts index f7f18c6fb9..d166523f1d 100644 --- a/packages/server/src/integrations/utils.ts +++ b/packages/server/src/integrations/utils.ts @@ -42,9 +42,9 @@ const SQL_STRING_TYPE_MAP = { nvarchar: FieldTypes.STRING, ntext: FieldTypes.STRING, enum: FieldTypes.STRING, - blob: FieldTypes.LONGFORM, - long: FieldTypes.LONGFORM, - text: FieldTypes.LONGFORM, + blob: FieldTypes.STRING, + long: FieldTypes.STRING, + text: FieldTypes.STRING, } const SQL_BOOLEAN_TYPE_MAP = {