Skip to content

Commit

Permalink
HCK-9315: fix adding storage option to table only if defined (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
serhii-filonenko authored Jan 2, 2025
1 parent 2272fb5 commit a79d4c9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
13 changes: 3 additions & 10 deletions forward_engineering/ddlProvider/ddlHelpers/tableHelper.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
const _ = require('lodash');
module.exports = ({
_,
getColumnsList,
checkAllKeysDeactivated,
commentIfDeactivated,
prepareName,
assignTemplates,
}) => {
module.exports = ({ getColumnsList, checkAllKeysDeactivated, commentIfDeactivated, prepareName, assignTemplates }) => {
const { getOptionsString } = require('./constraintHelper')({ _, prepareName });

const getTableType = ({
Expand Down Expand Up @@ -49,7 +42,7 @@ module.exports = ({
.filter(Boolean)
.join('');

return _.trim(statements) ? ` ${_.trim(statements)}` : '';
return _.trim(statements) ? `\n ${_.trim(statements)}` : '';
};

const getBlockChainClause =
Expand Down Expand Up @@ -78,7 +71,7 @@ module.exports = ({
const getStorage =
textTableProperties =>
({ organization, tablespace, logging }) => {
if (_.includes(textTableProperties, 'TABLESPACE')) {
if (!organization || _.includes(textTableProperties, 'TABLESPACE')) {
return '';
}

Expand Down
1 change: 0 additions & 1 deletion forward_engineering/ddlProvider/ddlProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ module.exports = (baseProvider, options, app) => {
createKeyConstraint,
customPropertiesForForeignKey,
} = require('./ddlHelpers/tableHelper')({
_,
checkAllKeysDeactivated,
getColumnsList,
commentIfDeactivated,
Expand Down
2 changes: 1 addition & 1 deletion forward_engineering/ddlProvider/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {

comment: '\nCOMMENT ON ${object} ${objectName} IS ${comment};\n',

createTable: 'CREATE${tableType} TABLE${ifNotExists} ${name}${tableProps}\n${options}',
createTable: 'CREATE${tableType} TABLE${ifNotExists} ${name}${tableProps}${options}',

createTableProps: '${columnDefinitions}${keyConstraints}${checkConstraints}${foreignKeyConstraints}',

Expand Down

0 comments on commit a79d4c9

Please sign in to comment.