How to use the db-migrate.driver 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 executeDB() {

    if( argv._.length > 0 )
    {
        argv.dbname = argv._.shift().toString();
    }
    else
    {
        log.info( 'Error: You must enter a database name!' );
        return;
    }

    index.driver( config.getCurrent().settings, function( err, db )
    {
        if( global.mode === 'create' )
        {
            db.createDatabase( argv.dbname, { ifNotExists: true }, function()
            {
                if( err )
                {
                    log.info( 'Error: Failed to create database!' );
                }
                else
                {
                    log.info( 'Created database "' + argv.dbname + '"' );
                }

                db.close();
            } );