diff --git a/forward_engineering/alterScript/alterScriptHelpers/columnHelpers/commentsHelper.js b/forward_engineering/alterScript/alterScriptHelpers/columnHelpers/commentsHelper.js index 62dd1af..0d2b248 100644 --- a/forward_engineering/alterScript/alterScriptHelpers/columnHelpers/commentsHelper.js +++ b/forward_engineering/alterScript/alterScriptHelpers/columnHelpers/commentsHelper.js @@ -41,10 +41,10 @@ const getUpdatedCommentOnColumnScriptDtos = ({ scriptFormat, collection }) => { const oldName = jsonSchema.compMod.oldField.name; const oldComment = collection.role.properties[oldName]?.description; - return newComment && (!oldComment || newComment !== oldComment); + return newComment !== oldComment; }) .map(([name, jsonSchema]) => { - const wrappedComment = wrapComment(jsonSchema.description); + const wrappedComment = jsonSchema.description ? wrapComment(jsonSchema.description) : 'NULL'; const columnName = prepareNameForScriptFormat(scriptFormat)(name); const fullColumnName = `${fullTableName}.${columnName}`; diff --git a/forward_engineering/alterScript/alterScriptHelpers/entityHelpers/commentsHelper.js b/forward_engineering/alterScript/alterScriptHelpers/entityHelpers/commentsHelper.js index e30055d..464d7fa 100644 --- a/forward_engineering/alterScript/alterScriptHelpers/entityHelpers/commentsHelper.js +++ b/forward_engineering/alterScript/alterScriptHelpers/entityHelpers/commentsHelper.js @@ -31,13 +31,13 @@ const getUpdatedCommentOnCollectionScriptDto = ({ scriptFormat, collection }) => } const { old: oldComment, new: newComment } = descriptionInfo; - if (!newComment || newComment === oldComment) { + if (newComment === oldComment) { return undefined; } const collectionSchema = getSchemaOfAlterCollection(collection); const fullTableName = getFullCollectionName(scriptFormat)(collectionSchema); - const comment = wrapComment(newComment); + const comment = newComment ? wrapComment(newComment) : 'NULL'; const script = updateTableComment(fullTableName, comment); return AlterScriptDto.getInstance([script], true, false); diff --git a/forward_engineering/alterScript/alterScriptHelpers/viewHelpers/commentsHelper.js b/forward_engineering/alterScript/alterScriptHelpers/viewHelpers/commentsHelper.js index 65b00a2..de5ef9c 100644 --- a/forward_engineering/alterScript/alterScriptHelpers/viewHelpers/commentsHelper.js +++ b/forward_engineering/alterScript/alterScriptHelpers/viewHelpers/commentsHelper.js @@ -25,13 +25,13 @@ const updateViewComment = (objectName, comment, isMaterializedView) => { const getUpdatedCommentScriptDto = ({ scriptFormat, view }) => { const description = view?.role?.compMod?.description || {}; - if (!description.new || description.new === description.old) { + if (description.new === description.old) { return; } const schemaName = view.compMod?.keyspaceName; const fullViewName = getNamePrefixedWithSchemaNameForScriptFormat(scriptFormat)(view.code || view.name, schemaName); - const wrappedComment = wrapComment(description.new); + const wrappedComment = description.new ? wrapComment(description.new) : 'NULL'; const script = updateViewComment(fullViewName, wrappedComment, view.materialized); return AlterScriptDto.getInstance([script], true, false);