Skip to content

Commit

Permalink
HCK-5355: "Create Index" statements in new entities in ALTER script i…
Browse files Browse the repository at this point in the history
…ncomplete (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
  • Loading branch information
WilhelmWesser authored Apr 18, 2024
1 parent 57fd315 commit 0e823e8
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const {AlterScriptDto} = require("../../types/AlterScriptDto");
* @return {({ columnId: string, collection: AlterCollectionDto }) => string | undefined}
* */
const getColumnNameById = ({_}) => ({columnId, collection}) => {
const rolePropertiesEntries = _.toPairs(collection.role.properties || {}).map(([name, value]) => ({...value, name}))
const rolePropertiesEntries = _.toPairs(collection?.role?.properties || collection?.properties || {}).map(([name, value]) => ({...value, name}))
const oldProperties = (collection?.role?.compMod?.oldProperties || []).map(property => ({...property, GUID: property.id}))
const properties = rolePropertiesEntries.length > 0 ? rolePropertiesEntries : oldProperties
const propertySchema = properties.find(fieldJsonSchema => fieldJsonSchema.GUID === columnId);
Expand Down Expand Up @@ -322,7 +322,7 @@ const getModifyIndexesScriptDtos = ({_, ddlProvider}) => ({collection, dbVersion
const {getSchemaNameFromCollection} = require('../../../utils/general')(_);
const additionalDataForDdlProvider = {
dbData: {dbVersion},
tableName: collection?.compMod?.collectionName?.new || '',
tableName: collection?.compMod?.collectionName?.new || collection?.role?.name || '',
schemaName: getSchemaNameFromCollection({collection}) || '',
isParentActivated: collection.isActivated,
}
Expand Down

0 comments on commit 0e823e8

Please sign in to comment.