Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HCK-5204: [Cassandra] fix issue with not reflected changes in entity properties when entity fields are modified #126

Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion forward_engineering/helpers/alterScriptBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const getCommentedDropScript = (scriptDtos, data) => {
return scriptDtos;
}
return scriptDtos.map((dto = {}) => {
if (!dto?.scripts[0]?.isDropScript || !dto?.scripts[0]?.script) {
if (!dto?.scripts?.[0]?.isDropScript || !dto?.scripts?.[0]?.script) {
return dto;
}
return {
Expand Down
4 changes: 2 additions & 2 deletions forward_engineering/helpers/alterScriptFromDeltaHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,13 +255,13 @@ const handleItem = (item, udtMap, generator, data) => {
alterTableScript = Object.keys(itemProperties)
.reduce((alterTableScript, tableKey) => {
const itemCompModData = itemProperties[tableKey].role.compMod;
const codeName = dependencies.lodash.get(itemProperties, `${tableKey}.role.code`, '');
const tableName = codeName.length ? codeName : tableKey;

if (!itemCompModData) {
return alterTableScript;
}

const codeName = dependencies.lodash.get(itemProperties, `${tableKey}.role.code`, '');
const tableName = codeName.length ? codeName : tableKey;
const tableProperties = itemProperties[tableKey].properties || {};

const keyspaceName = itemCompModData.keyspaceName;
Expand Down
7 changes: 4 additions & 3 deletions forward_engineering/helpers/updateHelpers/indexHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,9 +261,8 @@ const getDropIndexScript = (keyspaceName, tableName, secIndxs = []) => secIndxs.
const getAddSearchIndexScript = data => {
const { keyspaceName, tableName, searchIndex, dataSources, isActivated, dbVersion } = data;
const isExistScript = checkExistsScript(keyspaceName, tableName, 'createSearchIndexes');
const dataIndexScript = { ...scriptData, added: true, script: '' };
if (isExistScript) {
return [dataIndexScript];
return [];
}
setNameCollectionsScript(keyspaceName, tableName, 'createSearchIndexes');
const script = getIndexes(
Expand Down Expand Up @@ -468,9 +467,11 @@ const createDataSources = (item, data) => {
];
};

const getTableNameFromCompMod = table => table.role?.compMod?.collectionName?.new ?? table.role?.compMod?.collectionName?.old

const getIndexTable = (item, data, tableIsChange) => {
const dataSources = createDataSources(item, data);
const tableName = item.role?.code || item.role?.name;
const tableName = item.role?.code || item.role?.name || getTableNameFromCompMod(item);
const keyspaceName = item.role.compMod?.keyspaceName;
const dbVersion = data.modelData[0].dbVersion;
const isActivated = item.role?.isActivated;
Expand Down
2 changes: 1 addition & 1 deletion forward_engineering/helpers/updateHelpers/udtHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ const prepareField = (field, property) => {
const getUpdateScript = (item, data, udtMap) => {
const { role = {}, properties } = item;
if (!properties) {
return [scriptData];
return [];
}
const keySpaces = getKeySpaces(role);
const udtName = role.code || role.name;
Expand Down