fix(DB): Ignore intentionally missing fs_storage_path_prefix index on PostgreSQL

Signed-off-by: provokateurin <kate@provokateurin.de>
This commit is contained in:
provokateurin 2026-03-05 10:17:35 +01:00
parent 687d82843f
commit 8ae94242dc
No known key found for this signature in database

View file

@ -12,11 +12,16 @@ namespace OC\Core\Listener;
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)) {
@ -54,12 +59,14 @@ class AddMissingIndicesListener implements IEventListener {
'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',