index.js
function (files, latestMigrationFile) {
        if (direction === 'do') {
            return files
                .sort()
                .filter(function () {
                var _mustBeApplied = (latestMigrationFile === null);
                return function (name) {
                    if (latestMigrationFile === name) {
                        _mustBeApplied = !_mustBeApplied;
                        return false;
                    }
                    return _mustBeApplied;
                };
            }()
            );
        } else {
            return files.sort().reverse().filter(function (name) {
                return latestMigrationFile === name;
            });
        }
    }
function (files, latestMigrationFile) {
        if (direction === 'do') {
            return files
                .sort()
                .filter(function () {
                var _mustBeApplied = (latestMigrationFile === null);
                return function (name) {
                    if (latestMigrationFile === name) {
                        _mustBeApplied = !_mustBeApplied;
                        return false;
                    }
                    return _mustBeApplied;
                };
            }()
            );
        } else {
            return files.sort().reverse().filter(function (name) {
                return latestMigrationFile === name;
            });
        }
    }
function ( files , latestMigrationFile ) { if ( direction === 'do' ) { return files . sort ( ) . filter ( function ( ) { var _mustBeApplied = ( latestMigrationFile === null ) ; return function ( name ) { if ( latestMigrationFile === name ) { _mustBeApplied = ! _mustBeApplied ; return false ; } return _mustBeApplied ; } ; } ( ) ) ; } else { return files . sort ( ) . reverse ( ) . filter ( function ( name ) { return latestMigrationFile === name ; } ) ; } }
Filters through the files in the migration folder and finds the statements that need to be applied to the database
Filters through the files in the migration folder and finds the statements that need to be applied to the database