How to use the db-migrate.connect 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 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 );
github wzrdtales / node-ultimate-migrate / index.js View on Github external
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 ) );
        } );
    } );
}
github mozilla / openbadges-badgekit / lib / migrations.js View on Github external
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) {