From a79960bf2368c9e3879a399407fbaea057d9774a Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Thu, 14 Sep 2023 15:18:54 +0200 Subject: [PATCH] Typings --- .../backend/DataTable/modals/CreateEditColumn.svelte | 2 +- packages/server/src/api/controllers/table/utils.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index bfe7783e4f..c4342f9b0b 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -66,7 +66,7 @@ let jsonSchemaModal let allowedTypes = [] let editableColumn = { - type: "string", + type: fieldDefinitions.STRING.type, constraints: fieldDefinitions.STRING.constraints, // Initial value for column name in other table for linked records fieldName: $tables.selected.name, diff --git a/packages/server/src/api/controllers/table/utils.ts b/packages/server/src/api/controllers/table/utils.ts index 0e5b784c66..e77c2b7647 100644 --- a/packages/server/src/api/controllers/table/utils.ts +++ b/packages/server/src/api/controllers/table/utils.ts @@ -422,13 +422,11 @@ export function hasTypeChanged(table: Table, oldTable: Table | undefined) { if (!oldTable) { return false } - let key: any - let field: any - for ([key, field] of Object.entries(oldTable.schema)) { - const oldType = field.type + for (let [key, field] of Object.entries(oldTable.schema)) { if (!table.schema[key]) { continue } + const oldType = field.type const newType = table.schema[key].type if (oldType !== newType && !areSwitchableTypes(oldType, newType)) { return true