mirror of
https://github.com/nextcloud/spreed.git
synced 2025-12-17 21:12:20 +01:00
fix(object-rooms): Add an index on the room object columns
Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
parent
23ac6fd448
commit
7d4f2e8772
3 changed files with 41 additions and 0 deletions
|
|
@ -82,6 +82,7 @@ use OCA\Talk\Federation\Proxy\TalkV1\Notifier\RoomModifiedListener as TalkV1Room
|
|||
use OCA\Talk\Files\Listener as FilesListener;
|
||||
use OCA\Talk\Files\TemplateLoader as FilesTemplateLoader;
|
||||
use OCA\Talk\Flow\RegisterOperationsListener;
|
||||
use OCA\Talk\Listener\AddMissingIndicesListener;
|
||||
use OCA\Talk\Listener\BeforeUserLoggedOutListener;
|
||||
use OCA\Talk\Listener\BotListener;
|
||||
use OCA\Talk\Listener\CalDavEventListener;
|
||||
|
|
@ -138,6 +139,7 @@ use OCP\Collaboration\AutoComplete\AutoCompleteFilterEvent;
|
|||
use OCP\Collaboration\Resources\IProviderManager;
|
||||
use OCP\Collaboration\Resources\LoadAdditionalScriptsEvent;
|
||||
use OCP\Config\BeforePreferenceSetEvent;
|
||||
use OCP\DB\Events\AddMissingIndicesEvent;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Federation\ICloudFederationProvider;
|
||||
use OCP\Federation\ICloudFederationProviderManager;
|
||||
|
|
@ -352,6 +354,9 @@ class Application extends App implements IBootstrap {
|
|||
$context->registerSearchProvider(CurrentMessageSearch::class);
|
||||
$context->registerSearchProvider(MessageSearch::class);
|
||||
|
||||
// Fix database issues
|
||||
$context->registerEventListener(AddMissingIndicesEvent::class, AddMissingIndicesListener::class);
|
||||
|
||||
$context->registerDashboardWidget(TalkWidget::class);
|
||||
|
||||
$context->registerNotifierService(Notifier::class);
|
||||
|
|
|
|||
35
lib/Listener/AddMissingIndicesListener.php
Normal file
35
lib/Listener/AddMissingIndicesListener.php
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace OCA\Talk\Listener;
|
||||
|
||||
use OCP\DB\Events\AddMissingIndicesEvent;
|
||||
use OCP\EventDispatcher\Event;
|
||||
use OCP\EventDispatcher\IEventListener;
|
||||
|
||||
/**
|
||||
* @template-implements IEventListener<AddMissingIndicesEvent>
|
||||
*/
|
||||
class AddMissingIndicesListener implements IEventListener {
|
||||
#[\Override]
|
||||
public function handle(Event $event): void {
|
||||
if (!($event instanceof AddMissingIndicesEvent)) {
|
||||
// Unrelated
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Added to @see Version3003Date20180720162342
|
||||
*/
|
||||
$event->addMissingIndex(
|
||||
'talk_rooms',
|
||||
'tr_room_object',
|
||||
['object_type', 'object_id']
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -39,6 +39,7 @@ class Version3003Date20180720162342 extends SimpleMigrationStep {
|
|||
'length' => 64,
|
||||
'default' => '',
|
||||
]);
|
||||
$table->addIndex(['object_type', 'object_id'], 'tr_room_object');
|
||||
}
|
||||
|
||||
return $schema;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue