Executes outstanding migrations.

@param MigrationContext $context Context.

@return void
340592
public function run(MigrationContext $context)
	{
		$this->setContext($context);
		$this->createMigrationsTable();

		$all_migrations = $this->getAllMigrations();
		$executed_migrations = $this->getExecutedMigrations();

		$migrations_to_execute = array_diff($all_migrations, $executed_migrations);
		$this->executeMigrations($migrations_to_execute);

		$migrations_to_delete = array_diff($executed_migrations, $all_migrations);
		$this->deleteMigrations($migrations_to_delete);
	}
413294
public function run($context)
    {
        foreach ($this->actions as $step) {
            /** @var $step Action  **/
            codecept_debug("- $step");
            try {
                call_user_func_array([$context, $step->getAction()], $step->getArguments());
            } catch (\Exception $e) {
                $class = get_class($e); // rethrow exception for a specific action
                throw new $class($e->getMessage() . "\nat $step");
            }
        }
    }
1162709
public function addMigration(string $path, Migration $migrations): void{
        $name = basename($path);
        $this->migrations[$name] = $migrations;
    }
639737
protected function _setContext($context)
    {
        $this->context = ($context !== null)
            ? $this->_normalizeContainer($context)
            : null;
    }
186444
public function up()
    {
        $record = new MigrationRecord();
        if ($this->connection !== null) {
            $record->setConnection($this->connection);
        }
        $record->migration = $this->name;
        $record->save();
    }
847600
public function runMigration($plugin)
    {
        $command = new Migrate();
        $output = new NullOutput();
        $input = new ArrayInput(['--plugin' => $plugin]);
        $resultCode = $command->run($input, $output);
    }
989071
public function initializeContext(Context $context)
    {
        if (! $context instanceof WordpressAwareInterface) {
            return;
        }

        $context->setWordpress($this->wordpress);
        $context->setWordpressParameters($this->parameters);
    }
1341001
public function storeMigrationContext($migrationName, array $context)
    {
        $this->createTableIfNeeded();

        // select for update

        // annoyingly enough, neither Doctrine nor EZP provide built in support for 'FOR UPDATE' in their query builders...
        // at least the doctrine one allows us to still use parameter binding when we add our sql particle
        $conn = $this->getConnection();

        $qb = $conn->createQueryBuilder();
        $qb->select('*')
            ->from($this->tableName, 'm')
            ->where('migration = ?');
        $sql = $qb->getSQL() . ' FOR UPDATE';

        $conn->beginTransaction();

        $stmt = $conn->executeQuery($sql, array($migrationName));
        $existingMigrationData = $stmt->fetch(\PDO::FETCH_ASSOC);

        if (is_array($existingMigrationData)) {
            // context exists

            $conn->update(
                $this->tableName,
                array(
                    'context' => $this->contextToString($context),
                    'insertion_date' => time(),
                ),
                array('migration' => $migrationName)
            );
            $conn->commit();

        } else {
            // context did not exist. Create it!

            // commit immediately, to release the lock and avoid deadlocks
            $conn->commit();

            $conn->insert($this->tableName, array(
                'migration' => $migrationName,
                'context' => $this->contextToString($context),
                'insertion_date' => time(),
            ));
        }
    }
532683
public function migrateUp()
    {
        $this->builder->table(
            $this->table,
            function ($table) {
                $table->bigInteger('language_id')->unsigned()->nullable()->index();
            }
        );
    }
496443
public function setActiveContext($context)
    {
        $oldLocale = isset($this->activeContext) ? $this->contextLocales[$this->activeContext] : null;
        $this->activeContext = $context;
        if (!isset($this->contextLocales[$context])) {
            $this->setContextLocale($context, static::BASE_LOCALE);
        }
        $newLocale = $this->contextLocales[$context];
        if ($newLocale !== $oldLocale) {
            $this->currentLocaleChanged($newLocale);
        }
    }
206054
public function runMigration()
    {
        if ($this->confirm('Do you want to run all migration now?')) {
            $this->migrated = true;

            $this->console->call('migrate', [
                '--force' => $this->console->option('force'),
            ]);
        }
    }
381500
public function pushContext($key, $context)
    {
        $newContext = $this->getCurrentContext();
        $newContext[$key] = $context;
        $this->contextStack[] = $newContext;
    }
176873
public function moveMigrationFiles()
    {
        $databaseDirectory = base_path('Modules/'.$this->module.'/database');
        if (!$this->files->exists($databaseDirectory.'/migrations')) {
            return;
        }
        $files = $this->files->files($databaseDirectory.'/migrations');
        foreach ($files as $from) {
            $file = basename($from);
            $to = base_path('database/migrations/'.$file);
            $this->files->move($from, $to);
        }
        $this->files->deleteDirectory($databaseDirectory);
    }
746790
public function execute($actionContext) {
        $response = $actionContext->getHttpContext()->getResponse();

        if ($this->permanent === true && $this->preserveMethod !== true) {
            $response->setStatusCode(301);
        }
        elseif ($this->permanent !== true && $this->preserveMethod === true) {
            $response->setStatusCode(307);
        }
        elseif ($this->permanent === true && $this->preserveMethod === true) {
            $response->setStatusCode(308);
        }

        $response->addHeader('Location', $this->url);

        $response->end();
    }
152373
public function executeMigrations($file, $migrations)
    {
        foreach ($migrations as $index => $migration) {
            $migration = $this->keepBcForOldMigrationQueryFormat($index, $migration);
            $this->executeMigration($file, $migration);
        }
    }
936549
protected function assimilateContext(array $context = [])
    {
        $this->_context_ = $context;
        foreach ($context as $key => $value) {
            $this->$key = $value;
        }
    }
150746
public function setContext(RequestContext $context)
    {
        foreach ($this->matchers as $matcher) {
            $matcher->setContext($context);
        }

        $this->context = $context;
    }