File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed
forward_engineering/alterScript/alterScriptHelpers/entityHelpers Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ const wasCompositePkChangedInTransitionFromCompositeToRegular = collection => {
7676 * @type {AlterCollectionRoleCompModPKDto[] }
7777 * */
7878 const oldPrimaryKeys = pkDto . old || [ ] ;
79- const idsOfColumns = oldPrimaryKeys . flatMap ( pk => pk . compositePrimaryKey . map ( dto => dto . keyId ) ) ;
79+ const idsOfColumns = oldPrimaryKeys . flatMap ( pk => pk . compositePrimaryKey ? .map ( dto => dto . keyId ) || [ ] ) ;
8080 if ( idsOfColumns . length !== amountOfColumnsInRegularPk ) {
8181 // We return false, because it wouldn't count as transition between regular PK and composite PK
8282 // if composite PK did not constraint exactly 1 column
@@ -120,7 +120,7 @@ const wasCompositePkChangedInTransitionFromRegularToComposite = collection => {
120120 * @type {AlterCollectionRoleCompModPKDto[] }
121121 * */
122122 const newPrimaryKeys = pkDto . new || [ ] ;
123- const idsOfColumns = newPrimaryKeys . flatMap ( pk => pk . compositePrimaryKey . map ( dto => dto . keyId ) ) ;
123+ const idsOfColumns = newPrimaryKeys . flatMap ( pk => pk . compositePrimaryKey ? .map ( dto => dto . keyId ) || [ ] ) ;
124124 if ( idsOfColumns . length !== amountOfColumnsInRegularPk ) {
125125 // We return false, because it wouldn't count as transition between regular PK and composite PK
126126 // if composite PK does not constraint exactly 1 column
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ const wasCompositeUniqueKeyChangedInTransitionFromCompositeToRegular = collectio
7979 * @type {AlterCollectionRoleCompModUniqueKeyDto[] }
8080 * */
8181 const oldUniqueKeys = uniqueDto . old || [ ] ;
82- const idsOfColumns = oldUniqueKeys . flatMap ( unique => unique . compositeUniqueKey . map ( dto => dto . keyId ) ) ;
82+ const idsOfColumns = oldUniqueKeys . flatMap ( unique => unique . compositeUniqueKey ? .map ( dto => dto . keyId ) || [ ] ) ;
8383 if ( idsOfColumns . length !== amountOfColumnsInRegularUniqueKey ) {
8484 // We return false, because it wouldn't count as transition between regular UniqueKey and composite UniqueKey
8585 // if composite UniqueKey did not constraint exactly 1 column
@@ -124,7 +124,7 @@ const wasCompositeUniqueKeyChangedInTransitionFromRegularToComposite = collectio
124124 * @type {AlterCollectionRoleCompModUniqueKeyDto[] }
125125 * */
126126 const newUniqueKeys = uniqueDto . new || [ ] ;
127- const idsOfColumns = newUniqueKeys . flatMap ( unique => unique . compositeUniqueKey . map ( dto => dto . keyId ) ) ;
127+ const idsOfColumns = newUniqueKeys . flatMap ( unique => unique . compositeUniqueKey ? .map ( dto => dto . keyId ) || [ ] ) ;
128128 if ( idsOfColumns . length !== amountOfColumnsInRegularUniqueKey ) {
129129 // We return false, because it wouldn't count as transition between regular UniqueKey and composite UniqueKey
130130 // if composite UniqueKey does not constraint exactly 1 column
You can’t perform that action at this time.
0 commit comments