lib/migrate.js
function defaultMigrationLoader(dir) {
    let list = new List;
    
    return new Promise((resolve, reject) => {
        fs.readdir(dir, function(err, files) {
            if (err) return reject(err);
            
            const migrationFiles = files.filter((file) => file.match(/^\d+.*\.js$/)).sort();
            
            migrationFiles.forEach((file) => {
                let mod;
                try {
                    mod = require(path.join(dir, file));
                }
                catch (err) {
                    return reject(err);
                }
                
                list = list.addMigration(file, mod.up, mod.down);
            });
            
            resolve(list);
        });
    });
}
function defaultMigrationLoader(dir) {
    let list = new List;
    
    return new Promise((resolve, reject) => {
        fs.readdir(dir, function(err, files) {
            if (err) return reject(err);
            
            const migrationFiles = files.filter((file) => file.match(/^\d+.*\.js$/)).sort();
            
            migrationFiles.forEach((file) => {
                let mod;
                try {
                    mod = require(path.join(dir, file));
                }
                catch (err) {
                    return reject(err);
                }
                
                list = list.addMigration(file, mod.up, mod.down);
            });
            
            resolve(list);
        });
    });
}
function defaultMigrationLoader ( dir ) { let list = new List ; return new Promise ( ( resolve , reject ) => { fs . readdir ( dir , function ( err , files ) { if ( err ) return reject ( err ) ; const migrationFiles = files . filter ( ( file ) => file . match ( / ^\d+.*\.js$ / ) ) . sort ( ) ; migrationFiles . forEach ( ( file ) => { let mod ; try { mod = require ( path . join ( dir , file ) ) ; } catch ( err ) { return reject ( err ) ; } list = list . addMigration ( file , mod . up , mod . down ) ; } ) ; resolve ( list ) ; } ) ; } ) ; }
default migration loader.
load files from disk.
default migration loader . load files from disk .