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