Skip to content

Commit 0e823e8

Browse files
authored
HCK-5355: "Create Index" statements in new entities in ALTER script incomplete (missing table and column) (#97)
* HCK-5355: fixed issue with absent index columns * HCK-5355: added optional chain * HCK-5355: added another way for table name extraction
1 parent 57fd315 commit 0e823e8

File tree

1 file changed

+2
-2
lines changed
  • forward_engineering/alterScript/alterScriptHelpers/entityHelpers

1 file changed

+2
-2
lines changed

forward_engineering/alterScript/alterScriptHelpers/entityHelpers/indexesHelper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const {AlterScriptDto} = require("../../types/AlterScriptDto");
1313
* @return {({ columnId: string, collection: AlterCollectionDto }) => string | undefined}
1414
* */
1515
const getColumnNameById = ({_}) => ({columnId, collection}) => {
16-
const rolePropertiesEntries = _.toPairs(collection.role.properties || {}).map(([name, value]) => ({...value, name}))
16+
const rolePropertiesEntries = _.toPairs(collection?.role?.properties || collection?.properties || {}).map(([name, value]) => ({...value, name}))
1717
const oldProperties = (collection?.role?.compMod?.oldProperties || []).map(property => ({...property, GUID: property.id}))
1818
const properties = rolePropertiesEntries.length > 0 ? rolePropertiesEntries : oldProperties
1919
const propertySchema = properties.find(fieldJsonSchema => fieldJsonSchema.GUID === columnId);
@@ -322,7 +322,7 @@ const getModifyIndexesScriptDtos = ({_, ddlProvider}) => ({collection, dbVersion
322322
const {getSchemaNameFromCollection} = require('../../../utils/general')(_);
323323
const additionalDataForDdlProvider = {
324324
dbData: {dbVersion},
325-
tableName: collection?.compMod?.collectionName?.new || '',
325+
tableName: collection?.compMod?.collectionName?.new || collection?.role?.name || '',
326326
schemaName: getSchemaNameFromCollection({collection}) || '',
327327
isParentActivated: collection.isActivated,
328328
}

0 commit comments

Comments
 (0)