diff --git a/forward_engineering/helpers/alterScriptFromDeltaHelper.js b/forward_engineering/helpers/alterScriptFromDeltaHelper.js index b65da81b..df89e30a 100644 --- a/forward_engineering/helpers/alterScriptFromDeltaHelper.js +++ b/forward_engineering/helpers/alterScriptFromDeltaHelper.js @@ -375,8 +375,8 @@ module.exports = _ => { 'deleteUdtScriptsDtos', 'createUdtScriptsDtos', 'createCollectionsScriptsDtos', - 'modifyCollectionScriptsDtos', 'addColumnScriptsDtos', + 'modifyCollectionScriptsDtos', 'modifyColumnScriptDtos', 'createViewsScriptsDtos', 'modifiedViewsScriptsDtos', diff --git a/forward_engineering/helpers/keyHelper.js b/forward_engineering/helpers/keyHelper.js index e6ddccfb..5dc61dc1 100644 --- a/forward_engineering/helpers/keyHelper.js +++ b/forward_engineering/helpers/keyHelper.js @@ -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), }; }); }; @@ -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,