Skip to content

Commit 586dfcb

Browse files
committed
Added support of functional indexes for MySQL and Postgres
1 parent 7d8ea8b commit 586dfcb

6 files changed

+12
-9
lines changed

src/Driver/AbstractMySQLDriver.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ public function getDatabasePlatform(ServerVersionProvider $versionProvider): Abs
6363
return new MySQL8013Platform();
6464
}
6565

66-
if (
67-
version_compare($version, '8.0.0', '>=')
68-
&& version_compare($version, '8.0.13', '<')
69-
) {
66+
if (version_compare($version, '8.0.0', '>=')) {
7067
return new MySQL80Platform();
7168
}
7269

src/Platforms/AbstractPlatform.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ private function buildCreateTableSQL(Table $table, bool $createForeignKeys): arr
802802
'but platform "%s" does not support functional indexes.',
803803
$index->getName(),
804804
$table->getName(),
805-
substr(static::class, (int) strrpos(static::class, '\\') + 1),
805+
get_debug_type($this),
806806
));
807807
}
808808

@@ -1099,7 +1099,7 @@ public function getCreateIndexSQL(Index $index, string $table): string
10991099
'but platform "%s" does not support functional indexes.',
11001100
$name,
11011101
$table,
1102-
substr(static::class, (int) strrpos(static::class, '\\') + 1),
1102+
get_debug_type($this),
11031103
));
11041104
}
11051105

@@ -1560,7 +1560,7 @@ public function getIndexDeclarationSQL(Index $index): string
15601560
'Index "%s" contains a functional part, ' .
15611561
'but platform "%s" does not support functional indexes.',
15621562
$index->getName(),
1563-
substr(static::class, (int) strrpos(static::class, '\\') + 1),
1563+
get_debug_type($this),
15641564
));
15651565
}
15661566

src/Platforms/MySQL8013Platform.php

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Provides features of the MySQL since 8.0.13 database platform.
99
*
1010
* Note: Should not be used with versions prior to 8.0.13.
11+
* @deprecated This class will be removed once support for MySQL 8.0.13 is dropped.
1112
*/
1213
class MySQL8013Platform extends MySQL80Platform
1314
{

src/Platforms/MySQL84Platform.php

+5
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,9 @@ protected function createReservedKeywordsList(): KeywordList
1616
{
1717
return new MySQL84Keywords();
1818
}
19+
20+
public function supportsFunctionalIndex(): bool
21+
{
22+
return true;
23+
}
1924
}

src/Platforms/SQLitePlatform.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ public function getCreateIndexSQL(Index $index, string $table): string
568568
'but platform "%s" does not support functional indexes.',
569569
$name,
570570
$table,
571-
substr(static::class, (int) strrpos(static::class, '\\') + 1),
571+
get_debug_type($this),
572572
));
573573
}
574574

src/Schema/PostgreSQLSchemaManager.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ protected function _getPortableTableIndexesList(array $tableIndexes, string $tab
161161
{
162162
$buffer = [];
163163
foreach ($tableIndexes as $row) {
164-
$indexColumns = json_decode($row['index_columns'], true);
164+
$indexColumns = json_decode($row['index_columns'], true, flags: JSON_THROW_ON_ERROR);
165165

166166
foreach ($indexColumns as $colRow) {
167167
$buffer[] = [

0 commit comments

Comments
 (0)