app/Services/MigrationService.php
public function updateSchema($namespace, $schema_name, $target_version): bool
    {
        try {
            $current_version = (int) Site::getPreference($schema_name);
        } catch (PDOException $ex) {
            // During initial installation, the site_preference table won’t exist.
            $current_version = 0;
        }

        $updates_applied = false;

        // Update the schema, one version at a time.
        while ($current_version < $target_version) {
            $class = $namespace . '\\Migration' . $current_version;
            /** @var MigrationInterface $migration */
            $migration = new $class();
            $migration->upgrade();
            $current_version++;
            Site::setPreference($schema_name, (string) $current_version);
            $updates_applied = true;
        }

        return $updates_applied;
    }
public function updateSchema($namespace, $schema_name, $target_version): bool
    {
        try {
            $current_version = (int) Site::getPreference($schema_name);
        } catch (PDOException $ex) {
            // During initial installation, the site_preference table won’t exist.
            $current_version = 0;
        }

        $updates_applied = false;

        // Update the schema, one version at a time.
        while ($current_version < $target_version) {
            $class = $namespace . '\\Migration' . $current_version;
            /** @var MigrationInterface $migration */
            $migration = new $class();
            $migration->upgrade();
            $current_version++;
            Site::setPreference($schema_name, (string) $current_version);
            $updates_applied = true;
        }

        return $updates_applied;
    }
public function updateSchema ( $ namespace , $ schema_name , $ target_version ) : bool { try { $ current_version = ( int ) Site :: getPreference ( $ schema_name ) ; } catch ( PDOException $ ex ) { // During initial installation, the site_preference table won’t exist. $ current_version = 0 ; } $ updates_applied = false ; // Update the schema, one version at a time. while ( $ current_version < $ target_version ) { $ class = $ namespace . '\\Migration' . $ current_version ; /** @var MigrationInterface $migration */ $ migration = new $ class ( ) ; $ migration -> upgrade ( ) ; $ current_version ++ ; Site :: setPreference ( $ schema_name , ( string ) $ current_version ) ; $ updates_applied = true ; } return $ updates_applied ; }
Run a series of scripts to bring the database schema up to date.

@param string $namespace      Where to find our MigrationXXX classes
@param string $schema_name    Which schema to update.
@param int    $target_version Updade to this version

@throws PDOException
@return bool  Were any updates applied
Run a series of scripts to bring the database schema up to date .