From 9aadf972f1af41768290dcc6a97ce8f81ec50001 Mon Sep 17 00:00:00 2001 From: Alik Date: Thu, 19 Dec 2024 17:57:14 +0100 Subject: [PATCH] HCK-9173: comment out inactive schema statement in script (#70) --- 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 1f86e5a..579d343 100644 --- a/forward_engineering/api.js +++ b/forward_engineering/api.js @@ -34,7 +34,9 @@ module.exports = { callback(null, getAlterScript(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 aa2ad19..ccf8c71 100644 --- a/forward_engineering/helpers/createHelper.js +++ b/forward_engineering/helpers/createHelper.js @@ -43,7 +43,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 => {