Skip to content

Commit

Permalink
HCK-9291: fix edge case (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalii4as authored Dec 30, 2024
1 parent 09b5db9 commit 282ed36
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions forward_engineering/helpers/tableHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,16 +537,18 @@ const getCorrectUsing = using => {
* */
const getTablePropertiesClause = tableProperties => {
const isText = _.overEvery([value => _.isNaN(_.toNumber(value)), value => value !== 'true' && value !== 'false']);
const tablePropertyStatements = (tableProperties || []).map(({ propertyKey, propertyValue = undefined }) => {
let value = propertyValue;
if (value === undefined) {
return propertyKey;
}
if (isText(value)) {
value = `'${adjustPropertyValue(value)}'`;
}
return `${adjustPropertyKey(propertyKey)} = ${value}`;
});
const tablePropertyStatements = (tableProperties || [])
.filter(({ propertyKey }) => Boolean(adjustPropertyKey(propertyKey)))
.map(({ propertyKey, propertyValue = undefined }) => {
let value = propertyValue;
if (value === undefined) {
return propertyKey;
}
if (isText(value)) {
value = `'${adjustPropertyValue(value)}'`;
}
return `${adjustPropertyKey(propertyKey)} = ${value}`;
});
return tablePropertyStatements.join(', ');
};

Expand Down

0 comments on commit 282ed36

Please sign in to comment.