File tree Expand file tree Collapse file tree
forward_engineering/ddlProvider/ddlHelpers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -69,8 +69,14 @@ const foreignActiveKeysToString = keys => {
6969 * }}
7070 * */
7171const createKeyConstraint = ( templates , isParentActivated ) => keyData => {
72- const constraintName = wrapInQuotes ( _ . trim ( keyData . name ) ) ;
72+ if ( _ . isEmpty ( keyData . columns ) ) {
73+ return {
74+ statement : '' ,
75+ isActivated : false ,
76+ } ;
77+ }
7378 const isAllColumnsDeactivated = checkAllKeysDeactivated ( keyData . columns || [ ] ) ;
79+ const constraintName = wrapInQuotes ( _ . trim ( keyData . name ) ) ;
7480 const columns = ! _ . isEmpty ( keyData . columns )
7581 ? getColumnsList ( keyData . columns , isAllColumnsDeactivated , isParentActivated )
7682 : '' ;
@@ -149,10 +155,12 @@ const createInlineCheckConstraint = checkConstraint => {
149155const alterKeyConstraint = ( tableName , isParentActivated , keyData ) => {
150156 const constraintStatementDto = createKeyConstraint ( templates , isParentActivated ) ( keyData ) ;
151157 return {
152- statement : assignTemplates ( templates . addPkConstraint , {
153- constraintStatement : ( constraintStatementDto . statement || '' ) . trim ( ) ,
154- tableName,
155- } ) ,
158+ statement : constraintStatementDto . statement
159+ ? assignTemplates ( templates . addPkConstraint , {
160+ constraintStatement : constraintStatementDto . statement . trim ( ) ,
161+ tableName,
162+ } )
163+ : '' ,
156164 isActivated : constraintStatementDto . isActivated ,
157165 } ;
158166} ;
You can’t perform that action at this time.
0 commit comments