@@ -402,6 +402,60 @@ describe(Support.getTestDialectTeaser('db:migrate'), () => {
402
402
} ) ;
403
403
} ) ;
404
404
405
+ describeOnlyForSQLite ( Support . getTestDialectTeaser ( 'db:migrate' ) , ( ) => {
406
+ [ 'sqlite:./test.sqlite' , 'sqlite:../test.sqlite' ] . forEach ( ( url ) => {
407
+ describe ( `with url option containing relative path to a local storage file: ${ url } ` , ( ) => {
408
+ const prepare = function ( callback ) {
409
+ const config = { url } ;
410
+ const configContent = 'module.exports = ' + JSON . stringify ( config ) ;
411
+ let result = '' ;
412
+
413
+ return gulp
414
+ . src ( Support . resolveSupportPath ( 'tmp' ) )
415
+ . pipe ( helpers . clearDirectory ( ) )
416
+ . pipe ( helpers . runCli ( 'init' ) )
417
+ . pipe ( helpers . removeFile ( 'config/config.json' ) )
418
+ . pipe ( helpers . copyMigration ( 'createPerson.js' ) )
419
+ . pipe ( helpers . overwriteFile ( configContent , 'config/config.js' ) )
420
+ . pipe ( helpers . runCli ( 'db:migrate' ) )
421
+ . on ( 'error' , ( e ) => {
422
+ callback ( e ) ;
423
+ } )
424
+ . on ( 'data' , ( data ) => {
425
+ result += data . toString ( ) ;
426
+ } )
427
+ . on ( 'end' , ( ) => {
428
+ callback ( null , result ) ;
429
+ } ) ;
430
+ } ;
431
+
432
+ it ( 'creates a SequelizeMeta table' , function ( done ) {
433
+ const self = this ;
434
+
435
+ prepare ( ( ) => {
436
+ helpers . readTables ( self . sequelize , ( tables ) => {
437
+ expect ( tables ) . to . have . length ( 2 ) ;
438
+ expect ( tables ) . to . contain ( 'SequelizeMeta' ) ;
439
+ done ( ) ;
440
+ } ) ;
441
+ } ) ;
442
+ } ) ;
443
+
444
+ it ( 'creates the respective table' , function ( done ) {
445
+ const self = this ;
446
+
447
+ prepare ( ( ) => {
448
+ helpers . readTables ( self . sequelize , ( tables ) => {
449
+ expect ( tables ) . to . have . length ( 2 ) ;
450
+ expect ( tables ) . to . contain ( 'Person' ) ;
451
+ done ( ) ;
452
+ } ) ;
453
+ } ) ;
454
+ } ) ;
455
+ } ) ;
456
+ } ) ;
457
+ } ) ;
458
+
405
459
describe ( Support . getTestDialectTeaser ( 'db:migrate' ) , ( ) => {
406
460
describe ( 'optional migration parameters' , ( ) => {
407
461
const prepare = function ( runArgs = '' , callback ) {
@@ -626,3 +680,11 @@ function describeOnlyForESM(title, fn) {
626
680
describe . skip ( title , fn ) ;
627
681
}
628
682
}
683
+
684
+ function describeOnlyForSQLite ( title , fn ) {
685
+ if ( Support . getTestDialect ( ) === 'sqlite' ) {
686
+ describe ( title , fn ) ;
687
+ } else {
688
+ describe . skip ( title , fn ) ;
689
+ }
690
+ }
0 commit comments