Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion forward_engineering/helpers/alterScriptFromDeltaHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ module.exports = _ => {
'deleteUdtScriptsDtos',
'createUdtScriptsDtos',
'createCollectionsScriptsDtos',
'modifyCollectionScriptsDtos',
'addColumnScriptsDtos',
'modifyCollectionScriptsDtos',
'modifyColumnScriptDtos',
'createViewsScriptsDtos',
'modifiedViewsScriptsDtos',
Expand Down
27 changes: 25 additions & 2 deletions forward_engineering/helpers/keyHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,14 @@ module.exports = app => {
};

const getKeys = (keys, jsonSchema) => {
const newProperties = getSchemaNewProperties(jsonSchema);
const properties = { ...newProperties, ...jsonSchema.properties };

return keys.map(key => {
return {
name: findName(key.keyId, jsonSchema.properties),
name: findName(key.keyId, properties),
order: key.type === 'descending' ? 'DESC' : 'ASC',
isActivated: checkIfActivated(key.keyId, jsonSchema.properties),
isActivated: checkIfActivated(key.keyId, properties),
};
});
};
Expand Down Expand Up @@ -246,6 +249,26 @@ module.exports = app => {
return [primaryKeyConstraint, ...uniqueKeyConstraints].filter(Boolean);
};

/**
* @param {JsonSchema} jsonSchema
* @returns {JsonSchema}
*/
const getSchemaNewProperties = jsonSchema => {
if (!Array.isArray(jsonSchema.compMod?.newProperties)) {
return {};
}

return jsonSchema.compMod.newProperties.reduce((properties, property) => {
return {
...properties,
[property.code || property.name]: {
...property,
GUID: property.id,
},
};
}, {});
};

return {
getTableKeyConstraints,
isInlineUnique,
Expand Down