Skip to content

Commit

Permalink
HCK-8608: Oracle. Invalid COMMENT ON statements for Mat. Views in DDL…
Browse files Browse the repository at this point in the history
… Script tab
  • Loading branch information
Nightlngale committed Oct 31, 2024
1 parent ceb6544 commit e861565
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 7 additions & 1 deletion forward_engineering/ddlProvider/ddlProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,12 @@ module.exports = (baseProvider, options, app) => {
);
},

constructViewObjectForComment({ viewData }) {
const object = 'VIEW';

return viewData.materialized ? 'MATERIALIZED ' + object : object;
},

createView(viewData, dbData, isActivated) {
const viewName = getNamePrefixedWithSchemaName(viewData.name, viewData.schemaName);

Expand All @@ -623,7 +629,7 @@ module.exports = (baseProvider, options, app) => {
const comment = viewData.description
? '\n' +
assignTemplates(templates.comment, {
object: 'TABLE',
object: this.constructViewObjectForComment({ viewData }),
objectName: viewName,
comment: wrapComment(viewData.description),
}) +
Expand Down
8 changes: 4 additions & 4 deletions forward_engineering/utils/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ module.exports = _ => {
return '/* ' + statement + ' */';
} else if (statement.includes('\n')) {
return '/*\n' + statement + ' */\n';
} else {
return inlineComment + ' ' + statement;
}

return inlineComment + ' ' + statement;
};

const wrap = (str, start = "'", end = "'") => {
Expand All @@ -134,9 +134,9 @@ module.exports = _ => {

if (lastChar === start && firstChar === end) {
return str;
} else {
return `${start}${str}${end}`;
}

return `${start}${str}${end}`;
};

const wrapInQuotes = name => `"${name}"`;
Expand Down

0 comments on commit e861565

Please sign in to comment.