Skip to content

Commit b23ab0c

Browse files
Merge pull request #58734 from nextcloud/fix/db/postgres-filecache-path-prefix-index
2 parents 27f1bb1 + 8ae9424 commit b23ab0c

1 file changed

Lines changed: 13 additions & 6 deletions

File tree

core/Listener/AddMissingIndicesListener.php

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,16 @@
1212
use OCP\DB\Events\AddMissingIndicesEvent;
1313
use OCP\EventDispatcher\Event;
1414
use OCP\EventDispatcher\IEventListener;
15+
use OCP\IDBConnection;
1516

1617
/**
1718
* @template-implements IEventListener<AddMissingIndicesEvent>
1819
*/
1920
class AddMissingIndicesListener implements IEventListener {
21+
public function __construct(
22+
private readonly IDBConnection $connection,
23+
) {
24+
}
2025

2126
public function handle(Event $event): void {
2227
if (!($event instanceof AddMissingIndicesEvent)) {
@@ -54,12 +59,14 @@ public function handle(Event $event): void {
5459
'fs_size',
5560
['size']
5661
);
57-
$event->addMissingIndex(
58-
'filecache',
59-
'fs_storage_path_prefix',
60-
['storage', 'path'],
61-
['lengths' => [null, 64]]
62-
);
62+
if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_POSTGRES) {
63+
$event->addMissingIndex(
64+
'filecache',
65+
'fs_storage_path_prefix',
66+
['storage', 'path'],
67+
['lengths' => [null, 64]]
68+
);
69+
}
6370
$event->addMissingIndex(
6471
'filecache',
6572
'fs_parent',

0 commit comments

Comments
 (0)