concrete/src/Updater/Migrations/Configuration.php
public function registerPreviousMigratedVersions()
    {
        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);
        try {
            $minimum = $db->fetchColumn('select min(version) from SystemDatabaseMigrations');
        } catch (Exception $e) {
            return;
        }
        $migrations = $this->getMigrations();
        $keys = array_keys($migrations);

        if ($keys[0] == $minimum) {
            // This is the first migration in concrete5. That means we have already populated this table.
            return;
        } else {
            // We have to populate this table with all the migrations from the very first migration up to
            // the $minMigration
            foreach ($migrations as $key => $migration) {
                if ($key < $minimum) {
                    $migration->markMigrated();
                }
            }
        }
    }
public function registerPreviousMigratedVersions()
    {
        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);
        try {
            $minimum = $db->fetchColumn('select min(version) from SystemDatabaseMigrations');
        } catch (Exception $e) {
            return;
        }
        $migrations = $this->getMigrations();
        $keys = array_keys($migrations);

        if ($keys[0] == $minimum) {
            // This is the first migration in concrete5. That means we have already populated this table.
            return;
        } else {
            // We have to populate this table with all the migrations from the very first migration up to
            // the $minMigration
            foreach ($migrations as $key => $migration) {
                if ($key < $minimum) {
                    $migration->markMigrated();
                }
            }
        }
    }
public function registerPreviousMigratedVersions ( ) { $ app = Application :: getFacadeApplication ( ) ; $ db = $ app -> make ( Connection :: class ) ; try { $ minimum = $ db -> fetchColumn ( 'select min(version) from SystemDatabaseMigrations' ) ; } catch ( Exception $ e ) { return ; } $ migrations = $ this -> getMigrations ( ) ; $ keys = array_keys ( $ migrations ) ; if ( $ keys [ 0 ] == $ minimum ) { // This is the first migration in concrete5. That means we have already populated this table. return ; } else { // We have to populate this table with all the migrations from the very first migration up to // the $minMigration foreach ( $ migrations as $ key => $ migration ) { if ( $ key < $ minimum ) { $ migration -> markMigrated ( ) ; } } } }
This is a stupid requirement, but basically, we grab the lowest version number in our
system database migrations table, and we loop through all migrations in our file system
and for any of those LOWER than the lowest one in the table, we can assume they are included
in this migration. We then manually insert these rows into the SystemDatabaseMigrations table
so Doctrine isn't stupid and attempt to apply them.
This is a stupid requirement but basically we grab the lowest version number in our system database migrations table and we loop through all migrations in our file system and for any of those LOWER than the lowest one in the table we can assume they are included in this migration . We then manually insert these rows into the SystemDatabaseMigrations table so Doctrine isn t stupid and attempt to apply them .