Executes up a given number of migrations or a specific one.

Defaults to up all migrations if no count is given.
18912
function (specification, opts, callback) {
    var executeSync = load('sync');

    if (arguments.length > 0) {
      if (typeof specification === 'string') {
        this.internals.argv.destination = specification;
      }

      if (typeof opts === 'string') {
        this.internals.migrationMode = opts;
        this.internals.matching = opts;
      } else if (typeof opts === 'function') {
        callback = opts;
      }
    }

    return Promise.fromCallback(
      function (callback) {
        executeSync(this.internals, this.config, callback);
      }.bind(this)
    ).asCallback(callback);
  }
148059
protected function execute(array $migration_ids, $method_name) {
    array_walk($migration_ids, function ($migration_id) use ($method_name) {
      /** @var \Drupal\migrate\Plugin\Migration $migration */
      if (!$migration = $this->manager->createInstance($migration_id)) {
        throw new PluginNotFoundException($migration_id);
      }
      $migrate_executable = (new MigrateExecutable($migration, new MigrateMessage()));
      call_user_func_array([$migrate_executable, $method_name], []);
    });
  }
537493
public function migrateUp()
    {
        try {
            $this->builder->table(
                $this->table,
                function ($table) {
                    $table->string('value')->nullable()->change();
                }
            );
        } catch (\Exception $e) {
            dd($e->getMessage());
        }
    }
13838
def execute(self, conn, daoinput, transaction = False):
        	
        if not conn:
	    dbsExceptionHandler("dbsException-failed-connect2host", "Oracle/MigrationRequests/UpdateRequestStatus. Expects db connection from upper layer.", 
                                self.logger.exception)
        if daoinput['migration_status'] == 1:
           sql = self.sql2 
        elif daoinput['migration_status'] == 2:
            sql = self.sql + " and MIGRATION_STATUS = 1 "
        elif daoinput['migration_status'] == 3:
            sql = self.sql3 + " and MIGRATION_STATUS = 1 " 
        else:
            dbsExceptionHandler("dbsException-conflict-data", "Oracle/MigrationRequest/UpdateRequestStatus. Expected migration status to be 1, 2 or 3",
                                self.logger.exception)
        
	result = self.dbi.processData(sql, daoinput, conn, transaction)
777718
public function safeUp()
    {
        // 1. Run the install migration
	    if (!$this->db->tableExists(Map::TableName))
	        (new Install())->safeUp();

	    // 2. Upgrade the data
	    if ($this->db->tableExists('{{%simplemap_maps}}'))
	    	$this->_upgrade2();
	    else
	    	$this->_upgrade3();
    }
751398
def run_migrations_online():
    

    # this callback is used to prevent an auto-migration from being generated
    # when there are no changes to the schema
    # reference: http://alembic.zzzcomputing.com/en/latest/cookbook.html
    def process_revision_directives(context, revision, directives):
        if getattr(config.cmd_opts, 'autogenerate', False):
            script = directives[0]
            if len(script.upgrade_ops_list) >= len(bind_names) + 1:
                empty = True
                for upgrade_ops in script.upgrade_ops_list:
                    if not upgrade_ops.is_empty():
                        empty = False
                if empty:
                    directives[:] = []
                    logger.info('No changes in schema detected.')

    # for the direct-to-DB use case, start a transaction on all
    # engines, then run all migrations, then commit all transactions.
    engines = {
        '': {
            'engine': engine_from_config(
                config.get_section(config.config_ini_section),
                prefix='sqlalchemy.',
                poolclass=pool.NullPool,
            )
        }
    }
    for name in bind_names:
        engines[name] = rec = {}
        rec['engine'] = engine_from_config(
            context.config.get_section(name),
            prefix='sqlalchemy.',
            poolclass=pool.NullPool)

    for name, rec in engines.items():
        engine = rec['engine']
        rec['connection'] = conn = engine.connect()

        if USE_TWOPHASE:
            rec['transaction'] = conn.begin_twophase()
        else:
            rec['transaction'] = conn.begin()

    try:
        for name, rec in engines.items():
            logger.info("Migrating database %s" % (name or '<default>'))
            context.configure(
                connection=rec['connection'],
                upgrade_token="%s_upgrades" % name,
                downgrade_token="%s_downgrades" % name,
                target_metadata=get_metadata(name),
                process_revision_directives=process_revision_directives,
                **current_app.extensions['migrate'].configure_args
            )
            context.run_migrations(engine_name=name)

        if USE_TWOPHASE:
            for rec in engines.values():
                rec['transaction'].prepare()

        for rec in engines.values():
            rec['transaction'].commit()
    except:
        for rec in engines.values():
            rec['transaction'].rollback()
        raise
    finally:
        for rec in engines.values():
            rec['connection'].close()
1313014
def handle(self, *args, **options):
        
        self.do_list = options.get("do_list")
        self.do_execute = options.get("do_execute")
        self.do_create = options.get("do_create")
        self.do_create_all = options.get("do_create_all")
        self.do_seed = options.get("do_seed")
        self.load_initial_data = options.get("load_initial_data", True)
        self.args = args
        
        if options.get("path"):
            self.path = options.get("path")
        else:
            default_path = self._get_default_migration_path()
            self.path = getattr(
                settings, "NASHVEGAS_MIGRATIONS_DIRECTORY", default_path
            )
        
        self.verbosity = int(options.get("verbosity", 1))
        self.interactive = options.get("interactive")
        self.databases = options.get("databases")
        
        # We only use the default alias in creation scenarios (upgrades
        # default to all databases)
        if self.do_create and not self.databases:
            self.databases = [DEFAULT_DB_ALIAS]
        
        if self.do_create and self.do_create_all:
            raise CommandError("You cannot combine --create and --create-all")
        
        self.init_nashvegas()
        
        if self.do_create_all:
            self.create_all_migrations()
        elif self.do_create:
            assert len(self.databases) == 1
            self.create_migrations(self.databases[0])
        
        if self.do_execute:
            self.execute_migrations()
        
        if self.do_list:
            self.list_migrations()
        
        if self.do_seed:
            self.seed_migrations()
1282737
public function execUp(string $name): void{
        DB::connection('default')->table('migrations')->insert(['name' => $name]);
        $this->up();
    }
536348
def apply_migration(self, migration, **kwargs):
        '''
        
        '''
        cprint("\nAttempting to run %s" % migration, "cyan")
        # First check if the migration has already been applied
        exists = Migration.select().where(Migration.name == migration).limit(1).first()
        if exists and self.direction == 'up':
            cprint("This migration has already been run on this server", "red")
            if not self.force or self.fake:
                return False
            else:
                cprint("Force running this migration again", "yellow")

        # Load the module
        module_name = "%s.%s" % (self.module_name, migration)
        try:
            module = importlib.import_module(module_name)
            if not hasattr(module, self.direction):
                raise MigrationException("%s doesn't have %s migration defined" %
                    (migration, self.direction)
                )
            # Actually execute the direction method
            # Note that this doesn't actually run the migrations in the DB yet.
            # This merely collects the steps in the migration, so that if needed
            # we can just fake it and print out the SQL query as well.
            getattr(module, self.direction)(self)
            # Print out each migration and execute it
            for op in self.operations:
                self.execute_operation(op)

            if not self.fake:
                # If successful, create the entry in our log
                if self.direction == 'up' and not exists:
                    Migration.create(name=migration)
                elif self.direction == 'down' and exists:
                    exists.delete_instance()

            cprint("Done", "green")

        except ImportError:
            raise MigrationException("%s migration not found" % migration)
125842
protected function migrate()
    {
        if (! $this->container['migrator']->repositoryExists()) {
            throw new Exception('Migration table not found.');
        }

        $this->container['migrator']->run($this->getAttribute('path').'/database/migrations');
    }
879674
def up(self, migration_id=None, fake=False):
        """"""
        if not self.check_directory():
            return

        for migration in self.get_migrations_to_up(migration_id):
            logger.info('Executing migration: %s' % migration.filename)

            migration_module = self.load_migration_file(migration.filename)
            if not fake:
                if hasattr(migration_module, 'up'):
                    migration_module.up(self.db)
                else:
                    logger.error('No up method on migration %s' % migration.filename)

            record = migration.as_dict()
            record['date'] = datetime.utcnow()
            self.collection.insert(record)
1238385
public function execute( )
    {
        $this->doAction( self::ON_BEFORE_MIGRATE_CMD_EXECUTE_ACTION );
        
        if ( NULL === $this->migrator )
        {
            throw new MigrationException( 'You must set the migrator before executing this command.' );
        }
        
        $verbose   = self::getOption( $this, 'verbose' )->value;
        
        $direction = self::getOption( $this, 'direction' )->value;
        $levels    = self::getOption( $this, 'levels' )->value;
        
        $this->migrator->verbose = $verbose;
        
        switch( $direction )
        {
            case 'up':
                $this->migrator->migrateUp( $levels );
                break;
            
            case 'down':
                $this->migrator->migrateDown( $levels );
                break;
            
            default:
                // do nothing
                break;
        }
        
        $this->doAction( self::ON_AFTER_MIGRATE_CMD_EXECUTE_ACTION );
    }
1002784
public function apply()
    {

        $files = $this->getMigrationsFiles();
        $lastMigration = null;

        asort($files);

        foreach ($files as $key => $value) {
            if ($key <= $this->getVersion()) continue;
            include $this->migrateManager->storagePath . '/' . $value;
            $className = "Migration_$key";
            $class = new $className();
            $class->up();
            $lastMigration = $key;
            unset($class);
        }

        if (!is_null($lastMigration)) {
            $this->setVersion($lastMigration);
            echo Utils::colorize("Done!", "SUCCESS");
        } else {
            echo Utils::colorize("The latest version is already installed.", "NOTE");
        }

    }
858429
def run(*migration_classes)
      opts = migration_classes.extract_options!
      dir = opts[:direction] || :up
      dir = (dir == :down ? :up : :down) if opts[:revert]
      if reverting?
        # If in revert and going :up, say, we want to execute :down without reverting, so
        revert { run(*migration_classes, direction: dir, revert: true) }
      else
        migration_classes.each do |migration_class|
          migration_class.new.exec_migration(connection, dir)
        end
      end
    end
488754
public function migrate()
    {
        $fs = new Filesystem;
        $finder = new ClassFinder;
        $path = env('MIGRATIONS_PATH', 'database/migrations');

        if ($fs->exists($path)) {
            foreach ($fs->files($path) as $file) {
                $fs->requireOnce($file);
                $class = $finder->findClass($file);

                (new $class)->up();
            }
        }
    }
1263
def run_migration(data, version_start, version_end):
    """"""
    items = []
    if version_start == 1 and version_end == 2:
        for item in data['accounts']:
            items.append(v2.upgrade(item))

    if version_start == 2 and version_end == 1:
        for item in data:
            items.append(v2.downgrade(item))
        items = {'accounts': items}
    return items
62763
public function process()
    {
        // Migrate init - to create migration table
        $name = $this->argument('name');

        if (!is_null($name)) {
            if (string_has($name, ',')) {
                $this->seeder()->executeOnly($name);
            } else {
                $this->seeder()->executeOnly($name);
            }
        }

        $this->seeder()->run();

        $this->info('Seeding Completed Successfully!');
    }