index.js
function (latestMigrationFile) {
        return function (err, files) {
            if (err) {
                throw err;
            }
            files = _getApplicableMigrations(files, latestMigrationFile);

            var filesRemaining = files.length;
            var parsedMigrations = {};
            console.log('* Number of migration scripts to apply:', filesRemaining);
            if (filesRemaining === 0) {
//                me.client; // TODO : what is this ?
            }

            for (var file in files) {
                if (files.hasOwnProperty(file)) {

                    var filename = files[file];
                    var filepath = _config.migrationFolder + '/' + filename;
                    var parser = new migrationParser(filepath, me.client);
                    parser.on('ready', function () {
                        filesRemaining--;
                        parsedMigrations[basename(this.file)] = this;
                        if (filesRemaining === 0) {
                            var orderedMigrations = _orderMigrations(files, parsedMigrations);

                            // Here is where the migration really takes place
                            me.changelog.apply(orderedMigrations, direction);
                        }
                    });
                }
            }
        }
    }
function (latestMigrationFile) {
        return function (err, files) {
            if (err) {
                throw err;
            }
            files = _getApplicableMigrations(files, latestMigrationFile);

            var filesRemaining = files.length;
            var parsedMigrations = {};
            console.log('* Number of migration scripts to apply:', filesRemaining);
            if (filesRemaining === 0) {
//                me.client; // TODO : what is this ?
            }

            for (var file in files) {
                if (files.hasOwnProperty(file)) {

                    var filename = files[file];
                    var filepath = _config.migrationFolder + '/' + filename;
                    var parser = new migrationParser(filepath, me.client);
                    parser.on('ready', function () {
                        filesRemaining--;
                        parsedMigrations[basename(this.file)] = this;
                        if (filesRemaining === 0) {
                            var orderedMigrations = _orderMigrations(files, parsedMigrations);

                            // Here is where the migration really takes place
                            me.changelog.apply(orderedMigrations, direction);
                        }
                    });
                }
            }
        }
    }
function ( latestMigrationFile ) { return function ( err , files ) { if ( err ) { throw err ; } files = _getApplicableMigrations ( files , latestMigrationFile ) ; var filesRemaining = files . length ; var parsedMigrations = { } ; console . log ( '* Number of migration scripts to apply:' , filesRemaining ) ; if ( filesRemaining === 0 ) { //                me.client; // TODO : what is this ? } for ( var file in files ) { if ( files . hasOwnProperty ( file ) ) { var filename = files [ file ] ; var filepath = _config . migrationFolder + '/' + filename ; var parser = new migrationParser ( filepath , me . client ) ; parser . on ( 'ready' , function ( ) { filesRemaining -- ; parsedMigrations [ basename ( this . file ) ] = this ; if ( filesRemaining === 0 ) { var orderedMigrations = _orderMigrations ( files , parsedMigrations ) ; // Here is where the migration really takes place me . changelog . apply ( orderedMigrations , direction ) ; } } ) ; } } } }
Returns a function that, once run, will return the statements to be applied
Returns a function that once run will return the statements to be applied