@@ -161,7 +161,7 @@ function mixinMigration(PostgreSQL) {
161
161
const action = actions . shift ( ) ;
162
162
const pendingChanges = action && action ( ) || [ ] ;
163
163
if ( pendingChanges . length ) {
164
- self . applySqlChanges ( model , pendingChanges , function ( err , result ) {
164
+ self . applySqlChanges ( model , pendingChanges , options , function ( err , result ) {
165
165
if ( ! err ) {
166
166
applyPending ( actions , cb , err , result ) ;
167
167
} else {
@@ -201,7 +201,7 @@ function mixinMigration(PostgreSQL) {
201
201
self . getModelDefinition ( model ) . settings . foreignKeys ,
202
202
actualFks ) ;
203
203
204
- self . addForeignKeys ( model , fkSQL , cb ) ;
204
+ self . addForeignKeys ( model , fkSQL , options , cb ) ;
205
205
} ,
206
206
] , function ( err , result ) {
207
207
cb ( err , result [ 0 ] ) ;
@@ -438,13 +438,15 @@ function mixinMigration(PostgreSQL) {
438
438
createExtensions +
439
439
'CREATE SCHEMA ' +
440
440
self . escapeName ( self . schema ( model ) ) ,
441
+ [ ] ,
441
442
options ,
442
443
function ( err ) {
443
444
if ( err && err . code !== '42P06' ) {
444
445
return cb && cb ( err ) ;
445
446
}
446
447
self . execute ( 'CREATE TABLE ' + name + ' (\n ' +
447
448
self . propertiesSQL ( model ) + '\n)' ,
449
+ [ ] ,
448
450
options ,
449
451
function ( err , info ) {
450
452
if ( err ) {
@@ -456,7 +458,7 @@ function mixinMigration(PostgreSQL) {
456
458
}
457
459
const fkSQL = self . getForeignKeySQL ( model ,
458
460
self . getModelDefinition ( model ) . settings . foreignKeys ) ;
459
- self . addForeignKeys ( model , fkSQL , function ( err , result ) {
461
+ self . addForeignKeys ( model , fkSQL , options , function ( err , result ) {
460
462
cb ( err ) ;
461
463
} ) ;
462
464
} ) ;
@@ -621,11 +623,17 @@ function mixinMigration(PostgreSQL) {
621
623
}
622
624
} ;
623
625
624
- PostgreSQL . prototype . addForeignKeys = function ( model , fkSQL , cb ) {
626
+ PostgreSQL . prototype . addForeignKeys = function ( model , fkSQL , options , cb ) {
625
627
const self = this ;
626
628
629
+ if ( ( ! cb ) && typeof options === 'function' ) {
630
+ cb = options ;
631
+ options = { } ;
632
+ }
633
+ options = options || { } ;
634
+
627
635
if ( fkSQL && fkSQL . length ) {
628
- self . applySqlChanges ( model , [ fkSQL . toString ( ) ] , function ( err , result ) {
636
+ self . applySqlChanges ( model , [ fkSQL . toString ( ) ] , options , function ( err , result ) {
629
637
if ( err ) cb ( err ) ;
630
638
else
631
639
cb ( null , result ) ;
0 commit comments