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
19 changes: 13 additions & 6 deletions core/Listener/AddMissingIndicesListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@
use OCP\DB\Events\AddMissingIndicesEvent;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
use OCP\IDBConnection;

/**
* @template-implements IEventListener<AddMissingIndicesEvent>
*/
class AddMissingIndicesListener implements IEventListener {
public function __construct(
private readonly IDBConnection $connection,
) {
}

public function handle(Event $event): void {
if (!($event instanceof AddMissingIndicesEvent)) {
Expand Down Expand Up @@ -54,12 +59,14 @@ public function handle(Event $event): void {
'fs_size',
['size']
);
$event->addMissingIndex(
'filecache',
'fs_storage_path_prefix',
['storage', 'path'],
['lengths' => [null, 64]]
);
if ($this->connection->getDatabaseProvider() !== IDBConnection::PLATFORM_POSTGRES) {
$event->addMissingIndex(
'filecache',
'fs_storage_path_prefix',
['storage', 'path'],
['lengths' => [null, 64]]
);
}
$event->addMissingIndex(
'filecache',
'fs_parent',
Expand Down
Loading