console\controllers\MigrateController::migrateDown PHP Method

migrateDown() protected method

Downgrades with the specified migration class.
protected migrateDown ( string $class, $alias ) : boolean
$class string the migration class name
return boolean whether the migration is successful
    protected function migrateDown($class, $alias)
    {
        if ($class === self::BASE_MIGRATION) {
            return true;
        }
        echo "*** reverting {$class}\n";
        $start = microtime(true);
        $migration = $this->createMigration($class, $alias);
        if ($migration->down() !== false) {
            $this->db->createCommand()->delete($this->migrationTable, ['version' => $class])->execute();
            $time = microtime(true) - $start;
            echo "*** reverted {$class} (time: " . sprintf("%.3f", $time) . "s)\n\n";
            return true;
        } else {
            $time = microtime(true) - $start;
            echo "*** failed to revert {$class} (time: " . sprintf("%.3f", $time) . "s)\n\n";
            return false;
        }
    }