public function actionHistory(RequestApplicationInterface $app, $limit = 10)
    {
        if ($limit === 'all') {
            $limit = null;
        } else {
            $limit = (int)$limit;
            if ($limit < 1) {
                throw new Exception('The limit must be greater than 0.');
            }
        }

        return $this->getMigrationHistory($limit)->then(
            function($migrations) use ($limit) {
                if (empty($migrations)) {
                    $this->stdout("No migration has been done before.\n", Console::FG_YELLOW);
                } else {
                    $n = count($migrations);
                    if ($limit > 0) {
                        $this->stdout("Showing the last $n applied " . ($n === 1 ? 'migration' : 'migrations') . ":\n", Console::FG_YELLOW);
                    } else {
                        $this->stdout("Total $n " . ($n === 1 ? 'migration has' : 'migrations have') . " been applied before:\n", Console::FG_YELLOW);
                    }
                    foreach ($migrations as $version => $time) {
                        $this->stdout("\t(" . date('Y-m-d H:i:s', $time) . ') ' . $version . "\n");
                    }
                }
                return true;
            }
        );
    }
public function actionHistory(RequestApplicationInterface $app, $limit = 10)
    {
        if ($limit === 'all') {
            $limit = null;
        } else {
            $limit = (int)$limit;
            if ($limit < 1) {
                throw new Exception('The limit must be greater than 0.');
            }
        }

        return $this->getMigrationHistory($limit)->then(
            function($migrations) use ($limit) {
                if (empty($migrations)) {
                    $this->stdout("No migration has been done before.\n", Console::FG_YELLOW);
                } else {
                    $n = count($migrations);
                    if ($limit > 0) {
                        $this->stdout("Showing the last $n applied " . ($n === 1 ? 'migration' : 'migrations') . ":\n", Console::FG_YELLOW);
                    } else {
                        $this->stdout("Total $n " . ($n === 1 ? 'migration has' : 'migrations have') . " been applied before:\n", Console::FG_YELLOW);
                    }
                    foreach ($migrations as $version => $time) {
                        $this->stdout("\t(" . date('Y-m-d H:i:s', $time) . ') ' . $version . "\n");
                    }
                }
                return true;
            }
        );
    }
public function actionHistory ( RequestApplicationInterface $ app , $ limit = 10 ) { if ( $ limit === 'all' ) { $ limit = null ; } else { $ limit = ( int ) $ limit ; if ( $ limit < 1 ) { throw new Exception ( 'The limit must be greater than 0.' ) ; } } return $ this -> getMigrationHistory ( $ limit ) -> then ( function ( $ migrations ) use ( $ limit ) { if ( empty ( $ migrations ) ) { $ this -> stdout ( "No migration has been done before.\n" , Console :: FG_YELLOW ) ; } else { $ n = count ( $ migrations ) ; if ( $ limit > 0 ) { $ this -> stdout ( "Showing the last $n applied " . ( $ n === 1 ? 'migration' : 'migrations' ) . ":\n" , Console :: FG_YELLOW ) ; } else { $ this -> stdout ( "Total $n " . ( $ n === 1 ? 'migration has' : 'migrations have' ) . " been applied before:\n" , Console :: FG_YELLOW ) ; } foreach ( $ migrations as $ version => $ time ) { $ this -> stdout ( "\t(" . date ( 'Y-m-d H:i:s' , $ time ) . ') ' . $ version . "\n" ) ; } } return true ; } ) ; }
Displays the migration history.

This command will show the list of migrations that have been applied
so far. For example,

```
console migrate/history     # showing the last 10 migrations
console migrate/history 5   # showing the last 5 migrations
console migrate/history all # showing the whole history
```

@param RequestApplicationInterface $app
@param int|string                  $limit the maximum number of migrations to be displayed.
If it is "all", the whole migration history will be displayed.
@return ExtendedPromiseInterface
@throws Exception if invalid limit value passed
Displays the migration history .