|
|
|
@ -260,6 +260,19 @@ async function upgradeModels({
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!isCreatedByExists) { |
|
|
|
|
const columnName = getUniqueColumnName(columns, 'created_by'); |
|
|
|
|
const dbColumn = dbColumns.find((c) => c.cn === columnName); |
|
|
|
|
|
|
|
|
|
// if column already exist in db but not in meta, just update the meta (partial upgraded case)
|
|
|
|
|
if (dbColumn) { |
|
|
|
|
existingDbColumns.push({ |
|
|
|
|
uidt: UITypes.CreatedBy, |
|
|
|
|
...dbColumn, |
|
|
|
|
column_name: columnName, |
|
|
|
|
title: getUniqueColumnAliasName(columns, 'nc_created_by'), |
|
|
|
|
system: true, |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
newColumns.push({ |
|
|
|
|
...(await getColumnPropsFromUIDT( |
|
|
|
|
{ |
|
|
|
@ -277,8 +290,22 @@ async function upgradeModels({
|
|
|
|
|
altered: Altered.NEW_COLUMN, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!isLastModifiedByExists) { |
|
|
|
|
const columnName = getUniqueColumnName(columns, 'updated_by'); |
|
|
|
|
const dbColumn = dbColumns.find((c) => c.cn === columnName); |
|
|
|
|
|
|
|
|
|
// if column already exist in db but not in meta, just update the meta (partial upgraded case)
|
|
|
|
|
if (dbColumn) { |
|
|
|
|
existingDbColumns.push({ |
|
|
|
|
uidt: UITypes.LastModifiedBy, |
|
|
|
|
...dbColumn, |
|
|
|
|
column_name: columnName, |
|
|
|
|
title: getUniqueColumnAliasName(columns, 'nc_updated_by'), |
|
|
|
|
system: true, |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
newColumns.push({ |
|
|
|
|
...(await getColumnPropsFromUIDT( |
|
|
|
|
{ |
|
|
|
@ -296,6 +323,7 @@ async function upgradeModels({
|
|
|
|
|
altered: Altered.NEW_COLUMN, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// alter table and add new columns if any
|
|
|
|
|
if (newColumns.length) { |
|
|
|
|