From 667cfa7aaaf43c9d200ad464d0c9bd2b68d7ca94 Mon Sep 17 00:00:00 2001 From: Alik Date: Thu, 19 Dec 2024 17:56:36 +0100 Subject: [PATCH] HCK-9173: comment out inactive schema statement in script (#145) --- forward_engineering/api.js | 4 +++- forward_engineering/helpers/createHelper.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/forward_engineering/api.js b/forward_engineering/api.js index 6953e41..880e093 100644 --- a/forward_engineering/api.js +++ b/forward_engineering/api.js @@ -36,7 +36,9 @@ module.exports = { callback(null, buildContainerLevelAlterScript(data.jsonSchema, udtTypeMap, data)); } else { - let script = `${getKeyspaceStatement(data.containerData)}\n\n${getCreateTableScript(data, true)}`; + const isKeyspaceActivated = retrieveIsItemActivated(data.containerData); + const statement = `${getKeyspaceStatement(data.containerData)}\n\n${getCreateTableScript(data, isKeyspaceActivated)}`; + const script = commentDeactivatedStatement(statement, isKeyspaceActivated); callback(null, script); } } catch (e) { diff --git a/forward_engineering/helpers/createHelper.js b/forward_engineering/helpers/createHelper.js index d71526a..60dc366 100644 --- a/forward_engineering/helpers/createHelper.js +++ b/forward_engineering/helpers/createHelper.js @@ -45,7 +45,7 @@ const getCreateTableScript = (data, isKeyspaceActivated) => { const cqlScript = getScript([UDF, UDA, ...UDT, table, indexes]); - return commentDeactivatedStatement(cqlScript, isEntityActivated && isKeyspaceActivated); + return commentDeactivatedStatement(cqlScript, isEntityActivated, isKeyspaceActivated); }; const getScript = structure => {