@@ -26,15 +26,20 @@ module.exports = (baseProvider, options, app) => {
2626 divideIntoActivatedAndDeactivated,
2727 commentIfDeactivated,
2828 } ) ;
29- const { generateConstraintsString, foreignKeysToString, foreignActiveKeysToString, createKeyConstraint } =
30- require ( './helpers/constraintsHelper' ) ( {
31- _,
32- commentIfDeactivated,
33- checkAllKeysDeactivated,
34- assignTemplates,
35- getColumnsList,
36- wrapInQuotes,
37- } ) ;
29+ const {
30+ generateConstraintsString,
31+ foreignKeysToString,
32+ foreignActiveKeysToString,
33+ createKeyConstraint,
34+ getConstraintsWarnings,
35+ } = require ( './helpers/constraintsHelper' ) ( {
36+ _,
37+ commentIfDeactivated,
38+ checkAllKeysDeactivated,
39+ assignTemplates,
40+ getColumnsList,
41+ wrapInQuotes,
42+ } ) ;
3843 const keyHelper = require ( './helpers/keyHelper' ) ( _ , clean ) ;
3944
4045 const { getFunctionsScript } = require ( './helpers/functionHelper' ) ( {
@@ -175,10 +180,18 @@ module.exports = (baseProvider, options, app) => {
175180 } ) ;
176181
177182 const dividedKeysConstraints = divideIntoActivatedAndDeactivated (
178- keyConstraints . map ( createKeyConstraint ( templates , isActivated ) ) ,
183+ keyConstraints
184+ . filter ( ( { errorMessage } ) => ! errorMessage )
185+ . map ( createKeyConstraint ( templates , isActivated ) ) ,
179186 key => key . statement ,
180187 ) ;
181- const keyConstraintsString = generateConstraintsString ( dividedKeysConstraints , isActivated ) ;
188+ const constraintWarnings = getConstraintsWarnings (
189+ keyConstraints . filter ( ( { errorMessage } ) => errorMessage ) ,
190+ ) ;
191+ const keyConstraintsString = `${ generateConstraintsString (
192+ dividedKeysConstraints ,
193+ isActivated ,
194+ ) } ${ constraintWarnings } `;
182195 const keyConstraintsValue = partitionOf ? keyConstraintsString ?. slice ( 1 ) : keyConstraintsString ;
183196
184197 const dividedForeignKeys = divideIntoActivatedAndDeactivated ( foreignKeyConstraints , key => key . statement ) ;
@@ -531,7 +544,7 @@ module.exports = (baseProvider, options, app) => {
531544 }
532545
533546 jsonSchema = _ . omit ( jsonSchema , '$ref' ) ;
534- return { ...definitionJsonSchema , ...jsonSchema } ;
547+ return { ...definitionJsonSchema , ...jsonSchema } ;
535548 } ,
536549
537550 hydrateIndex ( indexData , tableData , schemaData ) {
0 commit comments