From dbe39571874ed187094d90a50f68c3ee16b8803e Mon Sep 17 00:00:00 2001 From: Tigrov Date: Sat, 19 Aug 2023 16:43:25 +0700 Subject: [PATCH] Get uniques using `getTableIndexes()` and `getTableUniques()` --- src/QueryBuilder/AbstractDMLQueryBuilder.php | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/QueryBuilder/AbstractDMLQueryBuilder.php b/src/QueryBuilder/AbstractDMLQueryBuilder.php index f8e9f728a..ea9a2402f 100644 --- a/src/QueryBuilder/AbstractDMLQueryBuilder.php +++ b/src/QueryBuilder/AbstractDMLQueryBuilder.php @@ -4,7 +4,6 @@ namespace Yiisoft\Db\QueryBuilder; -use Generator; use JsonException; use Yiisoft\Db\Constraint\Constraint; use Yiisoft\Db\Constraint\IndexConstraint; @@ -335,9 +334,7 @@ private function getTableUniqueColumnNames(string $name, array $columns, array & $constraints[] = $primaryKey; } - // TODO remove getTableIndexes(), getTableUniques() should be enough /** @psalm-var IndexConstraint[] $tableIndexes */ -/* $tableIndexes = $this->schema->getTableIndexes($name); foreach ($tableIndexes as $constraint) { @@ -345,7 +342,7 @@ private function getTableUniqueColumnNames(string $name, array $columns, array & $constraints[] = $constraint; } } -*/ + $constraints = array_merge($constraints, $this->schema->getTableUniques($name)); /**