console\controllers\MigrateController::getMigrationHistory PHP Method

getMigrationHistory() protected method

Returns the migration history.
protected getMigrationHistory ( integer $limit ) : array
$limit integer the maximum number of records in the history to be returned
return array the migration history
    protected function getMigrationHistory($limit)
    {
        if ($this->db->schema->getTableSchema($this->migrationTable, true) === null) {
            $this->createMigrationHistoryTable();
        }
        $query = new Query();
        $rows = $query->select(['version', 'alias', 'apply_time'])->from($this->migrationTable)->orderBy('version DESC')->limit($limit)->createCommand($this->db)->queryAll();
        $history = ArrayHelper::map($rows, 'version', 'apply_time');
        foreach ($rows as $row) {
            $history[$row['version']] = ['apply_time' => $row['apply_time'], 'alias' => $row['alias']];
        }
        unset($history[self::BASE_MIGRATION]);
        return $history;
    }