1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Core\Listener;
use OCP\DB\Events\AddMissingPrimaryKeyEvent;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
/**
* @template-implements IEventListener<AddMissingPrimaryKeyEvent>
*/
class AddMissingPrimaryKeyListener implements IEventListener {
public function handle(Event $event): void {
if (!($event instanceof AddMissingPrimaryKeyEvent)) {
return;
}
$event->addMissingPrimaryKey(
'federated_reshares',
'federated_res_pk',
['share_id'],
'share_id_index'
);
$event->addMissingPrimaryKey(
'systemtag_object_mapping',
'som_pk',
['objecttype', 'objectid', 'systemtagid'],
'mapping'
);
$event->addMissingPrimaryKey(
'comments_read_markers',
'crm_pk',
['user_id', 'object_type', 'object_id'],
'comments_marker_index'
);
$event->addMissingPrimaryKey(
'collres_resources',
'crr_pk',
['collection_id', 'resource_type', 'resource_id'],
'collres_unique_res'
);
$event->addMissingPrimaryKey(
'collres_accesscache',
'cra_pk',
['user_id', 'collection_id', 'resource_type', 'resource_id'],
'collres_unique_user'
);
$event->addMissingPrimaryKey(
'filecache_extended',
'fce_pk',
['fileid'],
'fce_fileid_idx'
);
}
}
|