From b3bea1e839b091efbe4beac0e50faa981c5e1716 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Wed, 22 May 2024 17:18:58 +0200 Subject: [PATCH] Block timeOnly changes in the api --- packages/server/src/sdk/app/tables/external/index.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/server/src/sdk/app/tables/external/index.ts b/packages/server/src/sdk/app/tables/external/index.ts index 98e6e561c8..53302085fc 100644 --- a/packages/server/src/sdk/app/tables/external/index.ts +++ b/packages/server/src/sdk/app/tables/external/index.ts @@ -73,6 +73,16 @@ function validate(table: Table, oldTable?: Table) { `Column "${key}" has subtype "${column.subtype}" - this is not supported.` ) } + + if (column.type === FieldType.DATETIME) { + const oldColumn = oldTable?.schema[key] as typeof column + + if (column.timeOnly !== oldColumn.timeOnly) { + throw new Error( + `Column "${key}" can not change from time to datetime or viceversa.` + ) + } + } } }