How to use the db-migrate/lib/log.error function in db-migrate

To help you get started, we’ve selected a few db-migrate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wzrdtales / node-ultimate-migrate / index.js View on Github external
function executeCreate()
{
    var folder, path;

    if ( argv._.length === 0 )
    {
        log.error( '\'migrationName\' is required.' );
        optimist.showHelp();
        process.exit( 1 );
    }

    createMigrationDir( argv[ 'migrations-dir' ], function ( err )
    {
        if ( err )
        {
            log.error( 'Failed to create migration directory at ', argv[ 'migrations-dir' ], err );
            process.exit( 1 );
        }

        argv.title = argv._.shift();
        folder = argv.title.split( '/' );

        argv.title = folder[ folder.length - 2 ] || folder[ 0 ];
github wzrdtales / node-ultimate-migrate / index.js View on Github external
case 'db':
        loadConfig();

        if( folder.length < 1 )
        {
            log.info( 'Please enter a valid command, i.e. db:create|db:drop' );
        }
        else
        {
            global.mode = folder[ 1 ];
            executeDB();
        }
        break;

    default:
        log.error( 'Invalid Action: Must be [up|down|create].' );
        optimist.showHelp();
        process.exit( 1 );
        break;
    }
}
github wzrdtales / node-ultimate-migrate / index.js View on Github external
createMigrationDir( argv[ 'migrations-dir' ], function ( err )
    {
        if ( err )
        {
            log.error( 'Failed to create migration directory at ', argv[ 'migrations-dir' ], err );
            process.exit( 1 );
        }

        var migration = config.getCurrent().settings.database;
        config.getCurrent().settings.diffDump = true;
        config.getCurrent().settings.database = migration + '_diff';
        config.getCurrent().settings.database_diff = migration + '_diff';

        executeUp( function ( err, complete, callback )
        {
            if ( err )
                process.exit( 1 );

            callback( function ( err )
            {
                if ( err )
github wzrdtales / node-ultimate-migrate / index.js View on Github external
process.on( 'uncaughtException', function ( err )
{
    log.error( err.stack );
    process.exit( 1 );
} );
github wzrdtales / node-ultimate-migrate / index.js View on Github external
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 )
        {
github wzrdtales / node-ultimate-migrate / lib / builder.js View on Github external
assert: function( condition, level, message )
    {

        if( typeof( level ) === 'string' )
        {
            message = level;
            level = { critical: false };
        }

        if( !condition )
        {
            return true;
        }

        log.error( message );

        if( level.critical )
            throw ( condition );

        return false;
    },