Any migration code in here is wrapped inside of a transaction.

@return bool
422548
public function safeUp()
    {
        $providersTable = $this->dbConnection->schema->getTable('{{oauth_providers}}');

        if ($providersTable)
        {
            if($this->renameColumn('{{oauth_providers}}', 'providerClass', 'class')) {
                OauthPlugin::log('Renamed `{{oauth_providers}}`.`providerClass` to `{{oauth_providers}}`.`class`.', LogLevel::Info, true);
            } else {
                OauthPlugin::log('Couldn\'t rename `{{oauth_providers}}`.`providerClass` to `{{oauth_providers}}`.`class`.', LogLevel::Warning);
            }
        }
        else
        {
            OauthPlugin::log('Could not find an `{{oauth_providers}}` table. Wut?', LogLevel::Error);
        }

        return true;
    }
495487
private function runMigration()
    {
        $this->info("Running database migration...");
        $this->call('migrate', ['--force' => true]);

        $this->line('');
        $this->advanceBar();

        $this->clearCaches();
        return $this;
    }
920947
public function rollback(): bool {
        if ($this->transactionExists) {
            $rolledBack = $this->pdo->rollBack();
            $this->transactionExists = !$rolledBack;
            return $rolledBack;
        }
        return false;
    }
1208054
public function rollbackTransaction(): bool
    {
        --$this->transactionLevel;

        if ($this->transactionLevel == 0) {
            $this->isProfiling() && $this->getLogger()->info('Rollback transaction');

            try {
                return $this->getPDO()->rollBack();
            } catch (\PDOException $e) {
                throw $this->mapException($e, "ROLLBACK TRANSACTION");
            }
        }

        $this->savepointRollback($this->transactionLevel + 1);

        return true;
    }
1058
public static function isUpgradeAvailable()
    {
        if (self::isInstallerAvailable()) {
            $migration_version = self::getMigrationVersion();
            $current_version = Symphony::Configuration()->get('version', 'symphony');

            return version_compare($current_version, $migration_version, '<');
        }

        return false;
    }
541877
protected function _trans_rollback()
	{
		if (odbc_rollback($this->conn_id))
		{
			odbc_autocommit($this->conn_id, TRUE);
			return TRUE;
		}

		return FALSE;
	}
963148
public function migrate()
    {
        // find migrations
        $folders = $this->app->pathfinder->search('dbupdates', '', 'path');
        // todo - sort files in folders
        foreach ($folders as $dir) {
            $files = scandir($dir);
            sort($files);
            foreach ($files as $name) {
                if (strtolower(substr($name, -4)) != '.sql') {
                    continue;
                }
                $q = $this->db->dsql()
                    ->table('_db_update')
                    ->where('name', strtolower($name))
                    ->field('status');
                if ($q->getOne() === 'ok') {
                    continue;
                }
                $migration = file_get_contents($dir.'/'.$name);
                $q->set('name', strtolower($name));
                try {
                    $this->db->dbh->exec($migration);
                    $q->set('status', 'ok')->replace();
                } catch (Exception $e) {
                    $q->set('status', 'fail')->replace();
                    if (!$e instanceof BaseException) {
                        $e = $this->exception()
                            ->addMoreInfo('Original error', $e->getMessage());
                    }
                    throw $e->addMoreInfo('file', $name);
                }
            }
        }

        return $this;
    }
652194
public function rollbackTransaction()
    {
        $this->db_connect('w', true);

        // check connection before proceeding
        if (!$this->is_connected()) {
            return $this->last_result = false;
        }

        $this->debug('ROLLBACK TRANSACTION');

        if (@oci_rollback($this->dbh)) {
            $this->in_transaction = false;
        }
        else {
            $this->handle_error('ROLLBACK');
        }

        return $this->last_result = $this->dbh->rollBack();
    }
1252034
public function rollback() : bool
    {
        $sql = 'ROLLBACK';

        if (!$this->transactionStarted) {
            $event = new TimerEvent('db.query');
            $this->emitQueryEvent($event, null, $sql);

            throw new QueryException(
                $this,
                $sql,
                "Can't rollback unstarted transaction"
            );
        }

        $this->query($sql);
        $this->transactionStarted = false;

        $this->instanceDispatcher()->emit(new Event('db.rollback'));

        return true;
    }
285489
public function rollback() {

        if($this->transactionCounter > 0) {
            $this->transactionCounter = 0;
            return parent::rollback();
        }//if

        $this->transactionCounter = 0;
        return false;

    }
607518
protected function transactionRollback() {
		if ( $this->transactionCounter >= 0 ) {
			$this->transactionCounter = 0;
			return $this->dbh->rollback();
		}
		$this->transactionCounter = 0;
		return false;
	}
1047206
public function commit() : bool
    {
        return $this->isConnected() && $this->getConnection()->inTransaction() && $this->getConnection()->commit();
    }
212648
public function endTransaction()
    {
        $this->db_connect('w', true);

        // check connection before proceeding
        if (!$this->is_connected()) {
            return $this->last_result = false;
        }

        $this->debug('COMMIT TRANSACTION');

        if ($result = @oci_commit($this->dbh)) {
            $this->in_transaction = true;
        }
        else {
            $this->handle_error('COMMIT');
        }

        return $this->last_result = $result;
    }
176754
protected static function cacheMigrations()
	{
		//check if already cached
		if (static::$MIGRATION_CACHE !== null) return true;

		//check if there is a connection
		if (!static::hasDbConnection() || Yii::$app->db->schema->getTableSchema('{{%migration}}') === null) {
			return false;
		}

		//load the data
		static::$MIGRATION_CACHE = [];
		$migrationData = (new Query())
			->select(['version','apply_time'])
			->from('{{%migration}}')
			->orderBy(['apply_time'=>SORT_ASC])
			->all();

		//fill the cache
		foreach ($migrationData as $migration) {
			static::$MIGRATION_CACHE[$migration['version']] = $migration['apply_time'];
		}

		return true;
	}
720387
protected function hasOldTables() {
        if(!file_exists(ASSETS_PATH.'/.codeBankMigrated')) {
            $tables=DB::tableList();
            if(array_key_exists('snippits', $tables) && array_key_exists('snippit_search', $tables)) {
                return true;
            }else {
                touch(ASSETS_PATH.'/.codeBankMigrated');
            }
        }
        
        return false;
    }
714091
protected function checkLessonsMigrationState()
    {
        $this->output->info('# Checkin lessons migration state... #');

        switch ($this->checkLessonMigrationStats()) {
            case 0:
                return true;
            case 1:
                $this->output->error(' Migration stats does not match!');
                if ($this->output->confirm('Do you wish to continue (lesson_migration and scool lesson tables will be truncated)?')) {
                    DB::connection('ebre_escool')->statement('DELETE FROM lesson_migration');
                    DB::connection('ebre_escool')->statement('ALTER TABLE lesson_migration AUTO_INCREMENT = 1');
                    DB::statement('DELETE FROM lessons');
                    DB::statement('ALTER TABLE lessons AUTO_INCREMENT = 1');
                    DB::statement('DELETE FROM lesson_user');
                    DB::statement('ALTER TABLE lesson_user AUTO_INCREMENT = 1');
                    DB::statement('DELETE FROM lesson_submodule');
                    DB::statement('ALTER TABLE lesson_submodule AUTO_INCREMENT = 1');
                    DB::statement('DELETE FROM classroom_submodule');
                    DB::statement('ALTER TABLE classroom_submodule AUTO_INCREMENT = 1');
                } else {
                    die();
                }
                return true;
            case 2:
                $this->output->info(' Lesson data seems already migrated. Skipping lessons migration...');
                return false;
        }
    }
717814
public function rollbackTransaction()
    {
        $this->connect();
        if (!$this->_connection->inTransaction()) {
            return false;
        }

        return $this->_connection->rollBack();
    }