Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function executeUp( callback )
{
if ( !argv.count )
{
argv.count = Number.MAX_VALUE;
}
index.connect( config.getCurrent().settings, function ( err, migrator )
{
assert.ifError( err );
if( global.locTitle )
migrator.migrationsDir = path.resolve( argv['migrations-dir'], global.locTitle );
else
migrator.migrationsDir = path.resolve( argv['migrations-dir'] );
migrator.driver.createMigrationsTable( function ( err )
{
assert.ifError( err );
log.verbose( 'migration table created' );
if ( typeof ( callback ) === 'function' )
callback( null, onComplete.bind( this, migrator ), function ( callback )
{
migrator.up( argv, callback );
function executeDown( callback )
{
if ( !argv.count )
{
log.info( 'Defaulting to running 1 down migration.' );
argv.count = 1;
}
index.connect( config.getCurrent().settings, function ( err, migrator )
{
assert.ifError( err );
migrator.migrationsDir = path.resolve( argv[ 'migrations-dir' ] );
migrator.driver.createMigrationsTable( function ( err )
{
assert.ifError( err );
if ( typeof ( callback ) === 'function' )
callback( null, onComplete.bind( this, migrator ), function ( callback )
{
migrator.down( argv, callback );
} );
else
migrator.down( argv, onComplete.bind( this, migrator ) );
} );
} );
}
up: function(options, callback) {
if (arguments.length == 1) {
callback = options;
options = {};
}
options.config = options.config;
options.count = options.count || Number.MAX_VALUE;
migrate.connect(options.config, function(err, migrator) {
if (err) throw err;
migrator.migrationsDir = module.exports.dir;
migrator.driver.createMigrationsTable(function(err) {
if (err) throw err;
migrator.up(options, function(err) {
migrator.driver.close();
callback(err);
});
});
});
},
down: function(options, callback) {