From d8564c98235e1a3f3ad57934a106e36dea0ab6b1 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Thu, 4 Jan 2024 13:19:28 +0000 Subject: [PATCH] fix: upgrader - column name population --- packages/nocodb/src/helpers/getColumnPropsFromUIDT.ts | 4 ++-- .../ncXcdbCreatedAndUpdatedTimeUpgrader.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/nocodb/src/helpers/getColumnPropsFromUIDT.ts b/packages/nocodb/src/helpers/getColumnPropsFromUIDT.ts index 5a3568e0a4..677904d1b1 100644 --- a/packages/nocodb/src/helpers/getColumnPropsFromUIDT.ts +++ b/packages/nocodb/src/helpers/getColumnPropsFromUIDT.ts @@ -39,9 +39,9 @@ export default async function getColumnPropsFromUIDT( const finalColumnMeta = { ...newColumn, ...column }; - if (finalColumnMeta.uidt === UITypes.CreatedTime) { + if (finalColumnMeta.uidt === UITypes.CreatedTime && !('column_name' in finalColumnMeta)) { finalColumnMeta.column_name = 'created_at'; - } else if (finalColumnMeta.uidt === UITypes.LastModifiedTime) { + } else if (finalColumnMeta.uidt === UITypes.LastModifiedTime && !('column_name' in finalColumnMeta)) { finalColumnMeta.column_name = 'updated_at'; } diff --git a/packages/nocodb/src/version-upgrader/ncXcdbCreatedAndUpdatedTimeUpgrader.ts b/packages/nocodb/src/version-upgrader/ncXcdbCreatedAndUpdatedTimeUpgrader.ts index 6a3fb9b04e..07fc210837 100644 --- a/packages/nocodb/src/version-upgrader/ncXcdbCreatedAndUpdatedTimeUpgrader.ts +++ b/packages/nocodb/src/version-upgrader/ncXcdbCreatedAndUpdatedTimeUpgrader.ts @@ -108,11 +108,11 @@ async function upgradeModels({ ...(await getColumnPropsFromUIDT( { uidt: UITypes.CreatedTime, - column_name: getUniqueColumnName(columns, 'created_at'), - title: getUniqueColumnAliasName(columns, 'Created At'), }, source, )), + column_name: getUniqueColumnName(columns, 'created_at'), + title: getUniqueColumnAliasName(columns, 'Created At'), system: true, altered: Altered.NEW_COLUMN, }); @@ -123,12 +123,12 @@ async function upgradeModels({ ...(await getColumnPropsFromUIDT( { uidt: UITypes.LastModifiedTime, - column_name: getUniqueColumnName(columns, 'updated_at'), - title: getUniqueColumnAliasName(columns, 'Updated At'), cdf: null, }, source, )), + column_name: getUniqueColumnName(columns, 'updated_at'), + title: getUniqueColumnAliasName(columns, 'Updated At'), system: true, altered: Altered.NEW_COLUMN, });