Add migrations to be applied.

        Args:
            migrations: a list of migrations to add of the form [(app, migration_name), ...]
        Raises:
            MigrationSessionError if called on a closed MigrationSession
182
def add_migrations(self, migrations):
        
        if self.__closed:
            raise MigrationSessionError("Can't change applied session")
        self._to_apply.extend(migrations)
1026423
def set_current_migration(self, migration_number=None):
        
        self.migration_data.version = migration_number or self.latest_migration
        self.session.commit()
1071034
protected function loadMigrationsFrom($paths): void
    {
        $options = \is_array($paths) ? $paths : ['--path' => $paths];

        if (isset($options['--realpath']) && \is_string($options['--realpath'])) {
            $options['--path'] = [$options['--realpath']];
        }

        $options['--realpath'] = true;

        $migrator = new MigrateProcessor($this, $options);
        $migrator->up();

        $this->beforeApplicationDestroyed(function () use ($migrator) {
            $migrator->rollback();
        });
    }
233975
def config_migration(migration_version)
      source = "#{Dir.pwd}/db/migrate/#{migration_version}_create_#{@scaffold_name}s.rb"
      modify_content(source, 'CreateMigration', "Create#{@model_class}s")   
      modify_content(source, 'migration', "#{@scaffold_name}s") 

      @arguments.each do |value| 
        @attributes << value.split(':').first 
        @data_types << value.split(':').last 
      end

      attribute_data_types = @data_types.reverse
      @attributes.reverse.each_with_index do |value,index|
        add_attributes(source, value, attribute_data_types[index])  
      end
    end
954061
private function makeUp($current_migrations, $migrations)
    {
        if (count($current_migrations) == count($migrations)) {
            echo Color::green('Nothing to migrate.');
            
            return;
        }

        foreach ($migrations as $file => $migration) {
            if ($this->checkMigrationExistance($migration)) {
                continue;
            }

            // Include the migration file
            require $file;

            try {
                // Up migration
                (new $migration)->up();
            } catch (\Exception $exception) {
                $this->throwMigrationException($exception, $migration);
            }

            // Create new migration status
            $this->createMigrationStatus($migration);
        }

        foreach ($current_migrations as $migration) {
            $this->updateMigrationStatus(
                $migration->migration,
                $migration->batch + 1
            );
        }
    }
640091
protected void migrateProcessInstance(MigratingProcessInstance migratingProcessInstance) {
    MigratingActivityInstance rootActivityInstance = migratingProcessInstance.getRootInstance();

    MigratingProcessElementInstanceTopDownWalker walker = new MigratingProcessElementInstanceTopDownWalker(rootActivityInstance);

    walker.addPreVisitor(
        new MigratingActivityInstanceVisitor(
            executionBuilder.isSkipCustomListeners(),
            executionBuilder.isSkipIoMappings()));
    walker.addPreVisitor(new MigrationCompensationInstanceVisitor());

    walker.walkUntil();
  }
1008322
def apply(config_override=None, tag_override=None, rollback=None, skip_missing=None):
    

    # Load config
    config = get_config(config_override)
    databases = config['databases']

    # If we are rolling back, ensure that we have a database tag
    if rollback and not tag_override:
        raise RuntimeError(
            'To rollback a migration you need to specify the database tag with `--tag`')

    for tag in sorted(databases):
        # If a tag is specified, skip other tags
        if tag_override and tag_override != tag:
            continue

        # Set vars
        engine = databases[tag].get('engine', 'mysql')
        host = databases[tag].get('host', 'localhost')
        port = databases[tag].get('port', 3306)
        user = databases[tag]['user']
        password = databases[tag]['password']
        db = databases[tag]['db']
        path = add_slash(databases[tag]['path'])
        pre_migration = databases[tag].get('pre_migration', None)
        post_migration = databases[tag].get('post_migration', None)

        # Check if the migration path exists
        if skip_missing:
            try:
                check_exists(path, 'dir')
            except RuntimeError:
                continue
        else:
            check_exists(path, 'dir')

        # Get database connection
        connection = get_connection(
            engine, host, user, port, password, db, get_ssl(databases[tag]))

        # Run pre migration queries
        if pre_migration:
            run_migration(connection, pre_migration, engine)

        if rollback:
            print(' * Rolling back %s (`%s` on %s)' % (tag, db, engine))

            rollback_migration(engine, connection, path, rollback)
        else:
            print(' * Applying migrations for %s (`%s` on %s)' %
                  (tag, db, engine))

            apply_migrations(engine, connection, path)

        # Run post migration queries
        if post_migration:
            run_migration(connection, post_migration, engine)

    return True
453855
def handle(self, *args, **options):
        

        from categories.migration import migrate_app
        from categories.settings import MODEL_REGISTRY
        if options['app_names']:
            for app in options['app_names']:
                migrate_app(None, app)
        else:
            for app in MODEL_REGISTRY:
                migrate_app(None, app)
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');
    }
1154022
private function executeRollBacks(array $migrations) : void
    {
        $this->connection->beginTransaction();

        foreach ($migrations as $migration) {
            $migration->down();
            $this->executedMigrations->delete(get_class($migration));
        }

        $this->connection->commit();
    }
1329762
protected function registerMigrations()
    {
        $path = $this->getBasePath() . '/' . $this->convention->migrationsFolder();

        if ($this->app->runningInConsole() && is_dir($path)) {
            $this->loadMigrationsFrom($path);
        }
    }
401369
def migrate(app_name=None, revision=None):
    ""
    cmd = ['python bin/manage.py syncdb --migrate']
    if app_name:
        cmd.append(app_name)
        if revision:
            cmd.append(revision)
    verun(' '.join(cmd))
230674
def create_manage_py(self, apps):
        
        self.logger.debug('Creating manage.py ...')
        with open(self._get_manage_py_path(), mode='w') as f:
            south_migration_modules = []
            for app in apps:
                south_migration_modules.append("'%(app)s': '%(app)s.south_migrations'" % {'app': app})

            f.write(MANAGE_PY % {
                'apps_available': "', '".join(apps),
                'apps_path': self.apps_path,
                'south_migration_modules': ", ".join(south_migration_modules)


            })
1238716
def migrations_to_run(self):
        
        assert self.database_current_migration is not None

        db_current_migration = self.database_current_migration

        return [
            (migration_number, migration_func)
            for migration_number, migration_func in self.sorted_migrations
            if migration_number > db_current_migration]
319044
def migrate_tables(tables, engine_name=None):
    
    from alembic.migration import MigrationContext
    engine = engine_manager[engine_name]
    mc = MigrationContext.configure(engine.session().connection)
    script =  get_migrate_script(mc, tables, engine.metadata)
    run_migrate_script(mc, script)
688919
def migrate(self, migrations_package_name, up_to=9999):
        '''
        
        '''
        from .migrations import MigrationHistory
        logger = logging.getLogger('migrations')
        applied_migrations = self._get_applied_migrations(migrations_package_name)
        modules = import_submodules(migrations_package_name)
        unapplied_migrations = set(modules.keys()) - applied_migrations
        for name in sorted(unapplied_migrations):
            logger.info('Applying migration %s...', name)
            for operation in modules[name].operations:
                operation.apply(self)
            self.insert([MigrationHistory(package_name=migrations_package_name, module_name=name, applied=datetime.date.today())])
            if int(name[:4]) >= up_to:
                break
911218
def allow_migrate(self, db, app_label, model_name=None, **hints):
        
        if model_name:
            model = apps.get_model(app_label, model_name)
        else:
            # hints are used with less priority, because many hints are dynamic
            # models made by migrations on a '__fake__' module which are not
            # SalesforceModels
            model = hints.get('model')

        if hasattr(model, '_salesforce_object'):
            # SF models can be migrated if SALESFORCE_DB_ALIAS is e.g.
            # a sqlite3 database or any non-SF database.
            if not (is_sf_database(db) or db == self.sf_alias):
                return False
        else:
            if is_sf_database(db) or self.sf_alias != 'default' and db == self.sf_alias:
                return False
        # TODO: It is usual that "migrate" is currently disallowed for SF.
        # In the future it can be implemented to do a deep check by
        # introspection of compatibily between Django models and SF database.
        if hasattr(model, '_salesforce_object'):
            # return False
            pass