How to use the db-migrate/lib/log.verbose 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
}
        break;

    default:
        log.error( 'Invalid Action: Must be [up|down|create].' );
        optimist.showHelp();
        process.exit( 1 );
        break;
    }
}

run();

if ( argv[ 'force-exit' ] )
{
    log.verbose( 'Forcing exit' );
    process.exit( 0 );
}
github wzrdtales / node-ultimate-migrate / lib / template / index.js View on Github external
var template, req;

    if ( config.template === undefined )
    {
        throw new Error( 'config must include a template key specifing which template to use' );
    }

    if( config.template && typeof( config.template ) === 'object' )
    {
        log.verbose( 'require:', config.template.require );
        template = require( config.template.require );
    }
    else
    {
        req = 'umigrate-' + config.template;
        log.verbose( 'require:', req );
        try
        {
            template = require( req );
        }
        catch ( Exception )
        {
            template = require( '../../' + req );
        }
    }

    log.verbose( 'loading template' );
    template.connect( config, function ( err, db )
    {
        if ( err )
        {
            callback( err );
github wzrdtales / node-ultimate-migrate / lib / driver / index.js View on Github external
var driver, req;

    if ( config.driver === undefined || config.altDriver === undefined )
    {
        throw new Error( 'config must include a driver key specifing which driver to use' );
    }

    if( config.altDriver && typeof( config.altDriver ) === 'object' )
    {
        log.verbose( 'require:', config.altDriver.require );
        driver = require( config.altDriver.require );
    }
    else
    {
        req = 'umigrate-' + ( config.altDriver || config.driver );
        log.verbose( 'require:', req );
        try
        {
            driver = require( req );
        }
        catch ( Exception )
        {
            driver = require( '../../../' + req );
        }
    }

    log.verbose( 'connecting' );
    driver.connect( config, function ( err, db )
    {

        if ( err )
        {
github wzrdtales / node-ultimate-migrate / lib / builder.js View on Github external
internals.diff.fn = self.diffArr( db, dbdiff );
                }

                ++internals.counter;
            } );
        } );


        while ( internals.counter < internals.max ) deasync.sleep( 100 );

        down( function()
        {
            self.templating( config );
        } );

        log.verbose( 'Collected Data Overview:', internals.diff );
    },
github wzrdtales / node-ultimate-migrate / lib / builder.js View on Github external
default:
                    cmd = internals.config.beautifier + ' ' + file;
                    break;
            }
        }

        if( !global.dryRun )
        {
            fs.writeFile( file, text, function( err )
            {
                self.assert( err, { critical: true }, 'Write to file failed!' );

                ++internals.written;
            } );

            log.verbose( file, text );
        }
        else
        {
            ++internals.written;
            log.info( file, text );
        }

        /**
          * We execute your custom beautifier, but don't care about the result.
          * You should ensure security yourself, because this could open a threat to attackers,
          * by modifying your config!
          *
          */
        if( cmd )
        {
            exec( cmd, function ( error, stdout, stderr )
github wzrdtales / node-ultimate-migrate / lib / builder.js View on Github external
build: function ( config, down, callback )
    {
        var self = this;

        internals.callback = callback;
        internals.config   = config;

        var caps = internals.driver.capabilities;
        log.verbose( 'Driver provides:', caps );

        self.checkCap( 'getTables', true, function()
        {
            internals.driver.getTables( config, function ( db )
            {
                if ( db[ 0 ].length !== 0 &&
                    ( db[ 1 ].length !== 0 || config.diffDump ) )
                {
                    internals.diff.tables = self.diffArr( db[ 0 ][ 0 ], db[ 1 ][ 0 ] );
                    internals.diff.views  = self.diffArr( db[ 0 ][ 1 ], db[ 1 ][ 1 ] );

                    var tableList = [];
                    tableList.tables = [ db[ 0 ][ 0 ], db[ 1 ][ 0 ] ];
                    tableList.views  = [ db[ 0 ][ 1 ], db[ 1 ][ 1 ] ];

                    internals.avTables    = self.subArr( db[ 0 ][ 0 ], internals.diff.tables[ 1 ] );
github wzrdtales / node-ultimate-migrate / lib / driver / mariasql.js View on Github external
db.on( 'connect', function ()
    {
        callback( null, new MariasqlDriver( db ) );
        log.verbose( 'Client connected.' );
    } )
        .on( 'error', function ( err )
github wzrdtales / node-ultimate-migrate / index.js View on Github external
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 );
                } );
            else
                migrator.up( argv, onComplete.bind( this, migrator ) );
        } );
    } );
github wzrdtales / node-ultimate-migrate / lib / builder.js View on Github external
write: function ( file, text, self )
    {
        var cmd = null,
        self = self || this;

        file = internals.migrationsDir + file;

        if( !file | !text )
        {
            ++internals.written;
            log.verbose( 'Error! Content of following file was empty: ' + file );
            return false;
        }

        if( internals.config.beautifier )
        {
            switch( internals.config.beautifier )
            {
                case 'js-beautify':
                    var beautify = require( 'js-beautify' ).js_beautify;
                    text = beautify( text, internals.config.beautifier_options );
                    break;

                default:
                    cmd = internals.config.beautifier + ' ' + file;
                    break;
            }
github wzrdtales / node-ultimate-migrate / lib / driver / index.js View on Github external
}
    else
    {
        req = 'umigrate-' + ( config.altDriver || config.driver );
        log.verbose( 'require:', req );
        try
        {
            driver = require( req );
        }
        catch ( Exception )
        {
            driver = require( '../../../' + req );
        }
    }

    log.verbose( 'connecting' );
    driver.connect( config, function ( err, db )
    {

        if ( err )
        {

            callback( err );
            return;
        }
        log.verbose( 'connected' );
        callback( null, db );
    } );
};