Browse Source

fix: upgrader - column name population

pull/7304/head
Pranav C 10 months ago
parent
commit
d8564c9823
  1. 4
      packages/nocodb/src/helpers/getColumnPropsFromUIDT.ts
  2. 8
      packages/nocodb/src/version-upgrader/ncXcdbCreatedAndUpdatedTimeUpgrader.ts

4
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';
}

8
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,
});

Loading…
Cancel
Save