Skip to content

Commit

Permalink
Remove yiisoft/array dependency (#203)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tigrov committed Oct 13, 2023
1 parent b2a3a0f commit 1ec213d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
1 change: 0 additions & 1 deletion composer.json
Expand Up @@ -25,7 +25,6 @@
"ext-filter": "*",
"symfony/console": "^6.0",
"yiisoft/aliases": "^1.1|^2.0|^3.0",
"yiisoft/arrays": "^2.0|^3.0",
"yiisoft/db": "^1.1",
"yiisoft/di": "^1.0",
"yiisoft/definitions": "^3.0",
Expand Down
11 changes: 4 additions & 7 deletions src/Migrator.php
Expand Up @@ -5,7 +5,6 @@
namespace Yiisoft\Db\Migration;

use Symfony\Component\Console\Style\SymfonyStyle;
use Yiisoft\Arrays\ArrayHelper;
use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Query\Query;
use Yiisoft\Db\Migration\Informer\MigrationInformerInterface;
Expand Down Expand Up @@ -83,18 +82,16 @@ public function getHistory(?int $limit = null): array
$this->checkMigrationHistoryTable();

$query = (new Query($this->db))
->select(['name', 'apply_time'])
->select(['apply_time', 'name'])
->from($this->historyTable)
->orderBy(['apply_time' => SORT_DESC, 'id' => SORT_DESC]);
->orderBy(['apply_time' => SORT_DESC, 'id' => SORT_DESC])
->indexBy('name');

if ($limit > 0) {
$query->limit($limit);
}

/** @psalm-var array<int,array<string,string|null>> $rows */
$rows = $query->all();

return ArrayHelper::map($rows, 'name', 'apply_time');
return $query->column();
}

public function getHistoryTable(): string
Expand Down

0 comments on commit 1ec213d

Please sign in to comment.