Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
createMigrationDir( sqlDir, function( err )
{
if ( err )
{
log.error( 'Failed to create migration directory at ', sqlDir, err );
process.exit( 1 );
}
var templateTypeDefaultSQL = Migration.TemplateType.DEFAULT_SQL;
var migrationUpSQL = new Migration( argv.title + '-up.sql', sqlDir, new Date(), templateTypeDefaultSQL );
index.createMigration( migrationUpSQL, function( err, migration )
{
assert.ifError( err );
log.info( util.format( 'Created migration up sql file at %s', migration.path ) );
} );
var migrationDownSQL = new Migration( argv.title + '-down.sql', sqlDir, new Date(), templateTypeDefaultSQL );
index.createMigration( migrationDownSQL, function( err, migration )
{
assert.ifError( err );
log.info( util.format( 'Created migration down sql file at %s', migration.path ) );
} );
} );
}
log.error( 'Failed to create migration directory at ', sqlDir, err );
process.exit( 1 );
}
var templateTypeDefaultSQL = Migration.TemplateType.DEFAULT_SQL;
var migrationUpSQL = new Migration( argv.title + '-up.sql', sqlDir, new Date(), templateTypeDefaultSQL );
index.createMigration( migrationUpSQL, function( err, migration )
{
assert.ifError( err );
log.info( util.format( 'Created migration up sql file at %s', migration.path ) );
} );
var migrationDownSQL = new Migration( argv.title + '-down.sql', sqlDir, new Date(), templateTypeDefaultSQL );
index.createMigration( migrationDownSQL, function( err, migration )
{
assert.ifError( err );
log.info( util.format( 'Created migration down sql file at %s', migration.path ) );
} );
} );
}
}
}
var templateType = Migration.TemplateType.DEFAULT_JS;
if( shouldCreateSqlFiles() )
{
templateType = Migration.TemplateType.SQL_FILE_LOADER;
}
else if( shouldCreateCoffeeFile() )
{
templateType = Migration.TemplateType.DEFAULT_COFFEE;
}
var migration = new Migration( argv.title + '.js', path, new Date(), templateType );
index.createMigration( migration, function ( err, migration )
{
assert.ifError( err );
log.info( util.format( 'Created migration at %s', migration.path ) );
} );
} );