Skip to content

Commit 88d7dbb

Browse files
committed
FE: fixed fe of warnings
1 parent 5cb8f8f commit 88d7dbb

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

forward_engineering/ddlProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ module.exports = (baseProvider, options, app) => {
191191
const keyConstraintsString = `${generateConstraintsString(
192192
dividedKeysConstraints,
193193
isActivated,
194-
)}\n\t${constraintWarnings}`;
194+
)}${constraintWarnings}`;
195195
const keyConstraintsValue = partitionOf ? keyConstraintsString?.slice(1) : keyConstraintsString;
196196

197197
const dividedForeignKeys = divideIntoActivatedAndDeactivated(foreignKeyConstraints, key => key.statement);

forward_engineering/helpers/constraintsHelper.js

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,20 @@ module.exports = ({
7070
};
7171

7272
const getConstraintsWarnings = (invalidConstraints = []) => {
73-
return invalidConstraints
74-
.map(keyData => {
75-
const constraintName = keyData.name ? ` [constraint name: ${keyData.name}]` : '';
73+
if (_.isEmpty(invalidConstraints)) {
74+
return '';
75+
}
76+
77+
return (
78+
'\n\t' +
79+
invalidConstraints
80+
.map(keyData => {
81+
const constraintName = keyData.name ? ` [constraint name: ${keyData.name}]` : '';
7682

77-
return `-- ${keyData.errorMessage}${constraintName}`;
78-
})
79-
.join('\n\t');
83+
return `-- ${keyData.errorMessage}${constraintName}`;
84+
})
85+
.join('\n\t')
86+
);
8087
};
8188

8289
return {

0 commit comments

Comments
 (0)