Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions forward_engineering/helpers/updateHelpers/tableHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ const hydrateColumn = ({ tableName, keyspaceName, isOldModel, property, udtMap,
};
};

const getTableParameter = (item, key) => {
const isCreated = item?.role?.compMod?.created;

return isCreated ? item?.role?.[key] : item?.role?.compMod?.[key]?.new;
};

const addToKeysHashType = (keysHash, keys) => {
return Object.entries(keysHash).reduce((keysHash, [id, key]) => {
const type = (keys.find(key => key.keyId === id) || {}).type;
Expand Down Expand Up @@ -211,8 +217,8 @@ const getAddTable = addTableData => {
}
let table = addTableData.item;
const data = addTableData.data;
const compositePartitionKey = table?.role?.compMod?.compositePartitionKey?.new || [];
const compositeClusteringKey = table?.role?.compMod?.compositeClusteringKey?.new || [];
const compositePartitionKey = getTableParameter(table, 'compositePartitionKey') || [];
const compositeClusteringKey = getTableParameter(table, 'compositeClusteringKey') || [];

const entityData = [
{
Expand Down