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;
            }
        );
    }