@@ -284,82 +284,70 @@ class SqliteAdapter {
284
284
waterfall ( [
285
285
//1. Check migrations table existence
286
286
function ( cb ) {
287
- if ( SqliteAdapter . supportMigrations ) {
288
- cb ( null , true ) ;
289
- return ;
290
- }
291
- self . table ( 'migrations' ) . exists ( function ( err , exists ) {
287
+ void self . table ( 'migrations' ) . exists ( function ( err , exists ) {
292
288
if ( err ) {
293
- cb ( err ) ;
294
- return ;
289
+ return cb ( err ) ;
295
290
}
296
- cb ( null , exists ) ;
291
+ return cb ( null , exists ) ;
297
292
} ) ;
298
293
} ,
299
294
//2. Create migrations table, if it does not exist
300
295
function ( arg , cb ) {
301
296
if ( arg ) {
302
- cb ( null , 0 ) ;
303
- return ;
297
+ return cb ( null , 0 ) ;
304
298
}
305
299
//create migrations table
306
- self . execute ( 'CREATE TABLE migrations("id" INTEGER PRIMARY KEY AUTOINCREMENT, ' +
300
+ void self . execute ( 'CREATE TABLE migrations("id" INTEGER PRIMARY KEY AUTOINCREMENT, ' +
307
301
'"appliesTo" TEXT NOT NULL, "model" TEXT NULL, "description" TEXT,"version" TEXT NOT NULL)' , [ ] , function ( err ) {
308
- if ( err ) {
309
- cb ( err ) ;
310
- return ;
311
- }
312
- SqliteAdapter . supportMigrations = true ;
313
- cb ( null , 0 ) ;
314
- } ) ;
302
+ if ( err ) {
303
+ return cb ( err ) ;
304
+ }
305
+ return cb ( null , 0 ) ;
306
+ } ) ;
315
307
} ,
316
308
//3. Check if migration has already been applied (true=Table version is equal to migration version, false=Table version is older from migration version)
317
309
function ( arg , cb ) {
318
- self . table ( migration . appliesTo ) . version ( function ( err , version ) {
310
+ void self . table ( migration . appliesTo ) . version ( function ( err , version ) {
319
311
if ( err ) {
320
- cb ( err ) ;
321
- return ;
312
+ return cb ( err ) ;
322
313
}
323
- cb ( null , ( version >= migration . version ) ) ;
314
+ return cb ( null , ( version >= migration . version ) ) ;
324
315
} ) ;
325
316
} ,
326
317
//4a. Check table existence (-1=Migration has already been applied, 0=Table does not exist, 1=Table exists)
327
318
function ( arg , cb ) {
328
319
//migration has already been applied (set migration.updated=true)
329
320
if ( arg ) {
330
321
migration . updated = true ;
331
- cb ( null , - 1 ) ;
322
+ return cb ( null , - 1 ) ;
332
323
}
333
324
else {
334
- self . table ( migration . appliesTo ) . exists ( function ( err , exists ) {
325
+ void self . table ( migration . appliesTo ) . exists ( function ( err , exists ) {
335
326
if ( err ) {
336
- cb ( err ) ;
337
- return ;
327
+ return cb ( err ) ;
338
328
}
339
- cb ( null , exists ? 1 : 0 ) ;
329
+ return cb ( null , exists ? 1 : 0 ) ;
340
330
} ) ;
341
331
}
342
332
} ,
343
333
//4. Get table columns
344
334
function ( arg , cb ) {
345
335
//migration has already been applied
346
336
if ( arg < 0 ) {
347
- cb ( null , [ arg , null ] ) ;
348
- return ;
337
+ return cb ( null , [ arg , null ] ) ;
349
338
}
350
- self . table ( migration . appliesTo ) . columns ( function ( err , columns ) {
339
+ void self . table ( migration . appliesTo ) . columns ( function ( err , columns ) {
351
340
if ( err ) {
352
- cb ( err ) ;
353
- return ;
341
+ return cb ( err ) ;
354
342
}
355
- cb ( null , [ arg , columns ] ) ;
343
+ return cb ( null , [ arg , columns ] ) ;
356
344
} ) ;
357
345
} ,
358
346
//5. Migrate target table (create or alter)
359
347
function ( args , cb ) {
360
348
//migration has already been applied (args[0]=-1)
361
349
if ( args [ 0 ] < 0 ) {
362
- cb ( null , args [ 0 ] ) ;
350
+ return cb ( null , args [ 0 ] ) ;
363
351
}
364
352
else if ( args [ 0 ] === 0 ) {
365
353
//create table
0 commit comments