protected function migrateDown($class)
    {
        if ($class === self::BASE_MIGRATION) {
            return resolveLazy(true);
        }

        $this->stdout("*** reverting $class\n", Console::FG_YELLOW);
        $start = microtime(true);
        $promise = new LazyPromise(function() use (&$migration, $class, $start) {
            return $this->createMigration($class)
                ->then(function($migration) {
                    /** @var MigrationInterface $migration */
                    return $migration->down();
                })->then(function() use ($class, $start) {
                    $time = microtime(true) - $start;
                    $this->stdout("*** reverted $class (time: " . sprintf('%.3f', $time) . "s)\n\n", Console::FG_GREEN);
                    return $this->removeMigrationHistory($class);
                }, function($error = null) use ($class, $start) {
                    $time = microtime(true) - $start;
                    $this->stdout("*** failed to revert $class (time: " . sprintf('%.3f', $time) . "s)\n\n", Console::FG_RED);
                    $prevException = $error instanceof \Throwable ? $error : null;
                    $exception = new Exception("Failed to revert $class (time: " . sprintf('%.3f', $time) . "s)", 0, $prevException);
                    throw new $exception;
                });
        });
        return $promise;
    }
protected function migrateDown($class)
    {
        if ($class === self::BASE_MIGRATION) {
            return resolveLazy(true);
        }

        $this->stdout("*** reverting $class\n", Console::FG_YELLOW);
        $start = microtime(true);
        $promise = new LazyPromise(function() use (&$migration, $class, $start) {
            return $this->createMigration($class)
                ->then(function($migration) {
                    /** @var MigrationInterface $migration */
                    return $migration->down();
                })->then(function() use ($class, $start) {
                    $time = microtime(true) - $start;
                    $this->stdout("*** reverted $class (time: " . sprintf('%.3f', $time) . "s)\n\n", Console::FG_GREEN);
                    return $this->removeMigrationHistory($class);
                }, function($error = null) use ($class, $start) {
                    $time = microtime(true) - $start;
                    $this->stdout("*** failed to revert $class (time: " . sprintf('%.3f', $time) . "s)\n\n", Console::FG_RED);
                    $prevException = $error instanceof \Throwable ? $error : null;
                    $exception = new Exception("Failed to revert $class (time: " . sprintf('%.3f', $time) . "s)", 0, $prevException);
                    throw new $exception;
                });
        });
        return $promise;
    }
protected function migrateDown ( $ class ) { if ( $ class === self :: BASE_MIGRATION ) { return resolveLazy ( true ) ; } $ this -> stdout ( "*** reverting $class\n" , Console :: FG_YELLOW ) ; $ start = microtime ( true ) ; $ promise = new LazyPromise ( function ( ) use ( & $ migration , $ class , $ start ) { return $ this -> createMigration ( $ class ) -> then ( function ( $ migration ) { /** @var MigrationInterface $migration */ return $ migration -> down ( ) ; } ) -> then ( function ( ) use ( $ class , $ start ) { $ time = microtime ( true ) - $ start ; $ this -> stdout ( "*** reverted $class (time: " . sprintf ( '%.3f' , $ time ) . "s)\n\n" , Console :: FG_GREEN ) ; return $ this -> removeMigrationHistory ( $ class ) ; } , function ( $ error = null ) use ( $ class , $ start ) { $ time = microtime ( true ) - $ start ; $ this -> stdout ( "*** failed to revert $class (time: " . sprintf ( '%.3f' , $ time ) . "s)\n\n" , Console :: FG_RED ) ; $ prevException = $ error instanceof \ Throwable ? $ error : null ; $ exception = new Exception ( "Failed to revert $class (time: " . sprintf ( '%.3f' , $ time ) . "s)" , 0 , $ prevException ) ; throw new $ exception ; } ) ; } ) ; return $ promise ; }
Downgrades with the specified migration class.
@param string $class the migration class name
@return LazyPromiseInterface whether the migration is successful
Downgrades with the specified migration class .