Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down