Execute the migration command inside a transaction layer.

@param string $method

@return void
507687
protected function executeInTransaction(string $method) : void
    {
        try {
            $this->database->beginTransaction();

            $this->{$method}();

            $this->database->commit();
        } catch (Exception $exception) {
            $this->database->rollBack();

            $this->handleException($exception);
        }
    }
1310709
public function check_progress( $method, $x = null ) {

		$method = str_replace( 'migrate_', '', $method );

		if ( isset( $this->progress[ $method ] ) ) {
			if ( null === $x ) {
				return $this->progress[ $method ];
			} elseif ( isset( $this->progress[ $method ][ $x ] ) ) {
				return (boolean) $this->progress[ $method ][ $x ];
			}
		}

		return false;
	}
1352942
public function setTransport($method=null){
        switch($method){
            case "stream":
                $this->defaultOptions= array_merge_recursive($this->defaultOptions,[
                    'stream'        => true,
                    'stream_context' => [
                        'ssl' => [
                            'verify_peer' => false,
                            'verify_peer_name' => false,
                            'allow_self_signed' => true
                        ]
                    ]
                ]);
                break;
            case "curl":
            default:
                $method = 'curl';
                break;
        }
        $this->transportMethod = $method;
        return $this->initClient(); 
    }
4498
public function execute(): void
	{
		$migrations = $this->getOutstanding();

		if(empty($migrations))
		{
			$this->write('<blue>There are no outstanding migrations.</blue>');

			return;
		}

		$batch = $this->builder()->max('batch') + 1;

		foreach($migrations as $migration)
		{
			$this->runMigration($migration, 'up', $batch);
		}

		$this->write('Ran the following migrations:' . PHP_EOL);

		$this->outputMigrationList($migrations);
	}
947171
public function execute()
    {
        /**
         * Migrate encrypted app settings to use new Encryption library
         */
        $oResult  = $this->query('SELECT id, value FROM {{NAILS_DB_PREFIX}}app_setting WHERE `is_encrypted` = 1');
        $oEncrypt = Factory::service('Encrypt');
        while ($oRow = $oResult->fetch(\PDO::FETCH_OBJ)) {

            $sNewCipher = $oEncrypt->migrate($oRow->value, APP_PRIVATE_KEY);

            //  Update the record
            $sQuery = '
                UPDATE `{{NAILS_DB_PREFIX}}app_setting`
                SET
                    `value` = :newValue
                WHERE
                    `id` = :id
            ';

            $oSth = $this->prepare($sQuery);

            $oSth->bindParam(':newValue', $sNewCipher, \PDO::PARAM_STR);
            $oSth->bindParam(':id', $oRow->id, \PDO::PARAM_INT);

            $oSth->execute();
        }
    }
228650
protected function rollbackMigration($migration)
    {
        if ($this->migrator->doesMigrationFileExist($migration)) {
            $this->migrator->rollbackMigration($migration);
        } else {
            $this->markRolledBackWithConfirmation($migration);
        }

        $this->message("<info>Rolled back:</info> {$migration}.php");
    }
946181
protected function executeMigrations(array $migrations)
	{
		if ( !$migrations ) {
			return;
		}

		$db = $this->_context->getDatabase();

		foreach ( $migrations as $migration ) {
			$db->beginTransaction();
			$migration_type = pathinfo($migration, PATHINFO_EXTENSION);

			$this->_migrationRunners[$migration_type]->run(
				$this->_migrationsDirectory . '/' . $migration,
				$this->_context
			);

			$sql = 'INSERT INTO Migrations (Name, ExecutedOn)
					VALUES (:name, :executed_on)';
			$db->perform($sql, array('name' => $migration, 'executed_on' => time()));
			$db->commit();
		}
	}
1083348
private function addMethod(string $method): void
    {
        if (!HttpMethod::isValid($method)) {
            throw new \InvalidArgumentException("Invalid HTTP request method '$method'");
        }

        $this->methods[] = $method;
    }
318625
public function dispatch($method, $parameters = [])
    {
        $base = ucfirst($method);
        $traits = $this->getRecursiveTraits();

        foreach ($traits as $trait) {
            $trait = explode('\\', $trait);
            $trait = str_replace('model', '', strtolower(array_pop($trait)));

            $method = $trait.$base;

            if (method_exists($this, $method)) {
                call_user_func_array([$this, $method], $parameters);
            }
        }
    }
616445
private function _processMigration(Migration $migration, callable $command)
    {
        if ($migration->isTransaction()) {
            $this->getDbRepository()->getAdapter()->transaction($command);
        } else {
            if ($this->logger) {
                $this->logger->alert('NO TRANSACTION!');
            }
            $command();
        }
    }
1055529
public function execute($request)
    {
        RequestNotSupportedException::assertSupports($this, $request);

        $details = ArrayObject::ensureArrayObject($request->getModel());

        $this->gateway->execute(new RefundTransaction($details));
    }
1135763
protected static function run($migrations, $name, $type, $method = 'up')
	{
		// storage for installed migrations
		$done = array();

		static::$connection === null or \DBUtil::set_connection(static::$connection);

		// Loop through the runnable migrations and run them
		foreach ($migrations as $ver => $migration)
		{
			logger(Fuel::L_INFO, 'Migrating to version: '.$ver);
			$result = call_user_func(array(new $migration['class'], $method));
			if ($result === false)
			{
				logger(Fuel::L_INFO, 'Skipped migration to '.$ver.'.');
				return false;
			}

			$file = basename($migration['path'], '.php');
			$method == 'up' ? static::write_install($name, $type, $file) : static::write_revert($name, $type, $file);
			$done[] = $file;
		}

		static::$connection === null or \DBUtil::set_connection(null);

		empty($done) or logger(Fuel::L_INFO, 'Migrated to '.$ver.' successfully.');

		return $done;
	}
1022934
private function assertMethodExists(string $method): void
    {
        if (!method_exists($this, $method)) {
            throw new MethodDoesNotExistException(
                sprintf("Specified method \"%s\" does not exist", $method)
            );
        }
    }
402327
public function setMethod($method)
	{
		parent::setMethod($method);
		$method = strtolower($method);
		if($method == "aes-256-ecb")
		{
			$this->_type = MCRYPT_RIJNDAEL_128;
			$this->_mode = "ecb";
		}
		elseif($method == "aes-256-cbc")
		{
			$this->_type = MCRYPT_RIJNDAEL_128;
			$this->_mode = "cbc";
		}
	}
1266641
protected function getQueries($migration, $method)
    {
        $connection = $migration->getConnection();

        // Now that we have the connections we can resolve it and pretend to run the
        // queries against the database returning the array of raw SQL statements
        // that would get fired against the database system for this migration.
        $db = $this->resolveConnection($connection);

        return $db->pretend(function() use ($migration, $method)
        {
            $migration->$method();
        });
    }
738978
public function setRequestMethod($method)
    {
        $this->requestMethod = $method === null ? self::DEFAULT_REQUEST_METHOD : strtoupper($method);
    }
581688
public function runInstall(Model $entity, ?string $database): void
    {
        $database = $this->asConnection($entity, $database);
        $table = $this->resolveMigrationTableName($entity);
        $migrator = $this->resolveMigrator($table);
        $repository = $migrator->getRepository();

        $migrator->setConnection($database);

        if (! $repository->repositoryExists()) {
            $repository->createRepository();

            $this->note("<info>Migration table {$table} created successfully.</info>");
        }

        $migrator->resetConnection();
    }