Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/Driver/MysqliDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,17 @@ public function createIndex(string $table, string $name, array $columns, bool $u
#[Override]
public function hasIndex(string $table, string $name): bool
{
$index = iterator_to_array($this->getPArray("SHOW INDEX FROM $table WHERE Key_name = ?", [$name]), false);
$index = iterator_to_array(
$this->getPArray(
'SELECT 1 FROM information_schema.statistics
WHERE table_schema = DATABASE()
AND table_name = ?
AND index_name = ?
LIMIT 1',
[$table, $name],
),
false,
);

return count($index) > 0;
}
Expand Down
Loading