Skip to content

Commit 4fd77a2

Browse files
committed
perf: add new index to server a full WHERE clause
Signed-off-by: Anna Larch <anna@nextcloud.com>
1 parent 59fdf96 commit 4fd77a2

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
/**
5+
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
6+
* SPDX-License-Identifier: AGPL-3.0-or-later
7+
*/
8+
9+
namespace OCA\Activity\Migration;
10+
11+
use Closure;
12+
use OCP\DB\ISchemaWrapper;
13+
use OCP\Migration\IOutput;
14+
use OCP\Migration\SimpleMigrationStep;
15+
16+
class Version2012Date20260309120000 extends SimpleMigrationStep {
17+
#[\Override]
18+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
19+
/** @var ISchemaWrapper $schema */
20+
$schema = $schemaClosure();
21+
22+
$table = $schema->getTable('activity');
23+
24+
if (!$table->hasIndex('activity_object_user')) {
25+
$table->addIndex(['affecteduser', 'object_type', 'object_id', 'timestamp'], 'activity_object_user');
26+
}
27+
28+
return $schema;
29+
}
30+
}

0 commit comments

Comments
 (0)