Skip to content

Commit 991952c

Browse files
HCK-14108: fix added table keys generation
1 parent 2b7653f commit 991952c

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

forward_engineering/helpers/updateHelpers/tableHelper.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ const hydrateColumn = ({ tableName, keyspaceName, isOldModel, property, udtMap,
121121
};
122122
};
123123

124+
const getTableParameter = (item, key) => {
125+
const isCreated = item?.role?.compMod?.created;
126+
127+
return isCreated ? item?.role?.[key] : item?.role?.compMod?.[key]?.new;
128+
};
129+
124130
const addToKeysHashType = (keysHash, keys) => {
125131
return Object.entries(keysHash).reduce((keysHash, [id, key]) => {
126132
const type = (keys.find(key => key.keyId === id) || {}).type;
@@ -211,8 +217,8 @@ const getAddTable = addTableData => {
211217
}
212218
let table = addTableData.item;
213219
const data = addTableData.data;
214-
const compositePartitionKey = table?.role?.compMod?.compositePartitionKey?.new || [];
215-
const compositeClusteringKey = table?.role?.compMod?.compositeClusteringKey?.new || [];
220+
const compositePartitionKey = getTableParameter(table, 'compositePartitionKey') || [];
221+
const compositeClusteringKey = getTableParameter(table, 'compositeClusteringKey') || [];
216222

217223
const entityData = [
218224
{

0 commit comments

Comments
 (0)