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 @@ -183,14 +183,13 @@ class AbstractDualityViewFeDdlCreator {
getCreateJsonRelationalDualityViewHeadingDdl(createViewDto, prepareName) {
const { jsonSchema, view } = createViewDto;
const template = this._ddlTemplates?.dualityView?.createJsonRelationalDualityViewHeading || '';
const dbVersion = view?.modelInfo?.dbVersion || '';

const orReplaceStatement = this._getOrReplaceStatement(view);
const forceStatement = this._getForceStatement(jsonSchema);
const editionableStatement = this._getEditionableStatement(jsonSchema);
const viewName = getViewName(view);
const ddlViewName = this._getNamePrefixedWithSchemaName(viewName, view.schemaName);
const annotations = getAnnotationsString(prepareName, dbVersion)(view.viewAnnotations);
const annotations = getAnnotationsString(prepareName)(view.viewAnnotations);

const params = {
orReplaceStatement,
Expand Down
2 changes: 1 addition & 1 deletion forward_engineering/ddlProvider/ddlHelpers/tableHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = ({ getColumnsList, checkAllKeysDeactivated, commentIfDeactivate
{ key: 'partitioning', getValue: getPartitioning },
{ key: 'selectStatement', getValue: getBasicValue('AS') },
{ key: 'tableProperties', getValue: value => _.trim(value) },
{ key: 'tableAnnotations', getValue: getAnnotationsString(prepareName, tableData?.dbVersion) },
{ key: 'tableAnnotations', getValue: getAnnotationsString(prepareName) },
]
.map(config => (tableData[config.key] ? wrap(config.getValue(tableData[config.key], tableData)) : ''))
.filter(Boolean)
Expand Down
9 changes: 4 additions & 5 deletions forward_engineering/ddlProvider/ddlProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ module.exports = (baseProvider, options, app) => {
const emptyLineSeparator = '\n\n';
const statementTerminator = ';';

const annotations = getAnnotationsString(prepareName, dbVersion)(schemaAnnotations);
const annotations = getAnnotationsString(prepareName)(schemaAnnotations);
const finalAnnotationsClause = annotations ? ' ' + annotations : '';
const preparedSchemaName = prepareName(schemaName);
const usingTryCatchWrapper = shouldUseTryCatchIfNotExistsWrapper(dbVersion);
Expand Down Expand Up @@ -228,7 +228,7 @@ module.exports = (baseProvider, options, app) => {
convertColumnDefinition(columnDefinition, template = templates.columnDefinition) {
const dbVersion = columnDefinition?.dbVersion;
const type = replaceTypeByVersion(columnDefinition.type, dbVersion);
const annotations = getAnnotationsString(prepareName, dbVersion)(columnDefinition.columnAnnotations);
const annotations = getAnnotationsString(prepareName)(columnDefinition.columnAnnotations);
const finalAnnotationsClause = annotations ? ' ' + annotations : '';

return commentIfDeactivated(
Expand Down Expand Up @@ -485,7 +485,6 @@ module.exports = (baseProvider, options, app) => {
selectStatement,
tableProperties,
tableAnnotations,
dbVersion,
}),
});
if (usingTryCatchWrapper) {
Expand Down Expand Up @@ -516,7 +515,7 @@ module.exports = (baseProvider, options, app) => {
const dbVersion = options.dbVersion || '';
const usingTryCatchWrapper = shouldUseTryCatchIfNotExistsWrapper(dbVersion);

const annotations = getAnnotationsString(prepareName, dbVersion)(index.indexAnnotations);
const annotations = getAnnotationsString(prepareName)(index.indexAnnotations);
const finalAnnotationsClause = annotations ? ' ' + annotations : '';

const shouldInsertIfNotExistsStatement = index.ifNotExist && !usingTryCatchWrapper;
Expand Down Expand Up @@ -670,7 +669,7 @@ module.exports = (baseProvider, options, app) => {
const dbVersion = _.get(viewData, 'modelInfo.dbVersion', '');
const usingTryCatchWrapper = shouldUseTryCatchIfNotExistsWrapper(dbVersion);

const annotations = getAnnotationsString(prepareName, dbVersion)(viewData.viewAnnotations);
const annotations = getAnnotationsString(prepareName)(viewData.viewAnnotations);

let createViewDdl = assignTemplates(templates.createView, {
name: viewName,
Expand Down
9 changes: 1 addition & 8 deletions forward_engineering/utils/getAnnotationsString.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,12 @@ const { wrapComment } = require('./general');
* }} Annotation
*/

const UNSUPPORTED_DB_VERSIONS = new Set(['12c', '18c']);

/**
* Generates annotations string.
* @param {function} prepareName - Function to format/escape identifiers
* @param {string} [dbVersion] - Database version
* @returns {(annotations: Annotation[]) => string} - returns Annotations string (e.g: "\nANNOTATIONS (...)") or ''.
*/
const getAnnotationsString = (prepareName, dbVersion) => annotations => {
if (!dbVersion || UNSUPPORTED_DB_VERSIONS.has(dbVersion)) {
return '';
}

const getAnnotationsString = prepareName => annotations => {
if (!Array.isArray(annotations) || annotations.length === 0) {
return '';
}
Expand Down
17 changes: 16 additions & 1 deletion properties_pane/model_level/modelLevelConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ making sure that you maintain a proper JSON format.
}

*/

[
{
"lowerTab": "Details",
Expand Down Expand Up @@ -171,6 +170,22 @@ making sure that you maintain a proper JSON format.
]
},
"adapter": "adaptUnavailableTypes"
},
{
"dependency": {
"type": "or",
"values": [
{
"key": "dbVersion",
"value": "12c"
},
{
"key": "dbVersion",
"value": "18c"
}
]
},
"adapter": "adaptOracleAnnotationsForLegacy"
}
]
},
Expand Down