Cli/Migrate.php
public function rollback($version)
    {
        $files = $this->getMigrationsFiles();
        $lastMigration = null;

        arsort($files);

        foreach ($files as $key => $value) {
            if ($key < $version) continue;
            include $this->migrateManager->storagePath . '/' . $value;
            $className = "Migration_$key";
            $class = new $className();
            $class->down();
            $lastMigration = $key;
            unset($class);
        }

        if (!is_null($lastMigration)) {
            $this->setVersion($lastMigration - 1);
            echo Utils::colorize("Done!", "SUCCESS");
        } else {
            echo Utils::colorize("The latest version is already installed.", "NOTE");
        }
    }
public function rollback($version)
    {
        $files = $this->getMigrationsFiles();
        $lastMigration = null;

        arsort($files);

        foreach ($files as $key => $value) {
            if ($key < $version) continue;
            include $this->migrateManager->storagePath . '/' . $value;
            $className = "Migration_$key";
            $class = new $className();
            $class->down();
            $lastMigration = $key;
            unset($class);
        }

        if (!is_null($lastMigration)) {
            $this->setVersion($lastMigration - 1);
            echo Utils::colorize("Done!", "SUCCESS");
        } else {
            echo Utils::colorize("The latest version is already installed.", "NOTE");
        }
    }
public function rollback ( $ version ) { $ files = $ this -> getMigrationsFiles ( ) ; $ lastMigration = null ; arsort ( $ files ) ; foreach ( $ files as $ key => $ value ) { if ( $ key < $ version ) continue ; include $ this -> migrateManager -> storagePath . '/' . $ value ; $ className = "Migration_$key" ; $ class = new $ className ( ) ; $ class -> down ( ) ; $ lastMigration = $ key ; unset ( $ class ) ; } if ( ! is_null ( $ lastMigration ) ) { $ this -> setVersion ( $ lastMigration - 1 ) ; echo Utils :: colorize ( "Done!" , "SUCCESS" ) ; } else { echo Utils :: colorize ( "The latest version is already installed." , "NOTE" ) ; } }
Return to a specific version
@param string $version Version number
@throws Exception
Return to a specific version