@@ -329,6 +329,8 @@ module.exports = (baseProvider, options, app) => {
329329 * relationshipOnDelete?: string,
330330 * relationshipOnUpdate?: string,
331331 * relationshipMatch?: string,
332+ * deferrable?: "" | "DEFERRABLE" | "NOT DEFERRABLE",
333+ * deferrableConstraintCheckTime?: "" | "INITIALLY IMMEDIATE" | "INITIALLY DEFERRED",
332334 * }}
333335 * @param primaryTableActivated {boolean}
334336 * @param foreignTableActivated {boolean}
@@ -376,7 +378,7 @@ module.exports = (baseProvider, options, app) => {
376378 primaryTableActivated &&
377379 foreignTableActivated ;
378380
379- const { foreignOnDelete, foreignOnUpdate, foreignMatch } =
381+ const { foreignOnDelete, foreignOnUpdate, foreignMatch, deferrable , deferrableConstraintCheckTime } =
380382 additionalPropertiesForForeignKey ( customProperties ) ;
381383
382384 const foreignKeyStatement = assignTemplates ( templates . createForeignKeyConstraint , {
@@ -387,6 +389,9 @@ module.exports = (baseProvider, options, app) => {
387389 onDelete : foreignOnDelete ? ` ON DELETE ${ foreignOnDelete } ` : '' ,
388390 onUpdate : foreignOnUpdate ? ` ON UPDATE ${ foreignOnUpdate } ` : '' ,
389391 match : foreignMatch ? ` MATCH ${ foreignMatch } ` : '' ,
392+ deferrable : deferrable ? ` ${ deferrable } ` : '' ,
393+ deferrableConstraintCheckTime : deferrable === 'DEFERRABLE' && deferrableConstraintCheckTime
394+ ? ` ${ deferrableConstraintCheckTime } ` : '' ,
390395 } ) ;
391396
392397 return {
@@ -451,7 +456,7 @@ module.exports = (baseProvider, options, app) => {
451456 primaryTableActivated &&
452457 foreignTableActivated ;
453458
454- const { foreignOnDelete, foreignOnUpdate, foreignMatch } =
459+ const { foreignOnDelete, foreignOnUpdate, foreignMatch, deferrable , deferrableConstraintCheckTime } =
455460 additionalPropertiesForForeignKey ( customProperties ) ;
456461
457462 const foreignKeyStatement = assignTemplates ( templates . createForeignKey , {
@@ -463,6 +468,9 @@ module.exports = (baseProvider, options, app) => {
463468 onDelete : foreignOnDelete ? ` ON DELETE ${ foreignOnDelete } ` : '' ,
464469 onUpdate : foreignOnUpdate ? ` ON UPDATE ${ foreignOnUpdate } ` : '' ,
465470 match : foreignMatch ? ` MATCH ${ foreignMatch } ` : '' ,
471+ deferrable : deferrable ? ` ${ deferrable } ` : '' ,
472+ deferrableConstraintCheckTime : deferrable === 'DEFERRABLE' && deferrableConstraintCheckTime
473+ ? ` ${ deferrableConstraintCheckTime } ` : '' ,
466474 } ) ;
467475
468476 return {
0 commit comments