Skip to content

Commit 3217b34

Browse files
icewind1991provokateurin
authored andcommitted
fix: fix legacy share mapping table indexes
Signed-off-by: Robin Appelman <robin@icewind.nl>
1 parent a27ecbc commit 3217b34

3 files changed

Lines changed: 46 additions & 0 deletions

File tree

apps/files_sharing/composer/composer/autoload_classmap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
'OCA\\Files_Sharing\\Migration\\Version33000Date20260306120000' => $baseDir . '/../lib/Migration/Version33000Date20260306120000.php',
9595
'OCA\\Files_Sharing\\Migration\\Version33000Date20260306150000' => $baseDir . '/../lib/Migration/Version33000Date20260306150000.php',
9696
'OCA\\Files_Sharing\\Migration\\Version35000Date20260720121254' => $baseDir . '/../lib/Migration/Version35000Date20260720121254.php',
97+
'OCA\\Files_Sharing\\Migration\\Version35000Date20260813121254' => $baseDir . '/../lib/Migration/Version35000Date20260813121254.php',
9798
'OCA\\Files_Sharing\\MountProvider' => $baseDir . '/../lib/MountProvider.php',
9899
'OCA\\Files_Sharing\\Notification\\Listener' => $baseDir . '/../lib/Notification/Listener.php',
99100
'OCA\\Files_Sharing\\Notification\\Notifier' => $baseDir . '/../lib/Notification/Notifier.php',

apps/files_sharing/composer/composer/autoload_static.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ class ComposerStaticInitFiles_Sharing
109109
'OCA\\Files_Sharing\\Migration\\Version33000Date20260306120000' => __DIR__ . '/..' . '/../lib/Migration/Version33000Date20260306120000.php',
110110
'OCA\\Files_Sharing\\Migration\\Version33000Date20260306150000' => __DIR__ . '/..' . '/../lib/Migration/Version33000Date20260306150000.php',
111111
'OCA\\Files_Sharing\\Migration\\Version35000Date20260720121254' => __DIR__ . '/..' . '/../lib/Migration/Version35000Date20260720121254.php',
112+
'OCA\\Files_Sharing\\Migration\\Version35000Date20260813121254' => __DIR__ . '/..' . '/../lib/Migration/Version35000Date20260813121254.php',
112113
'OCA\\Files_Sharing\\MountProvider' => __DIR__ . '/..' . '/../lib/MountProvider.php',
113114
'OCA\\Files_Sharing\\Notification\\Listener' => __DIR__ . '/..' . '/../lib/Notification/Listener.php',
114115
'OCA\\Files_Sharing\\Notification\\Notifier' => __DIR__ . '/..' . '/../lib/Notification/Notifier.php',
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCA\Files_Sharing\Migration;
11+
12+
use Closure;
13+
use OCP\DB\ISchemaWrapper;
14+
use OCP\Migration\Attributes\AddIndex;
15+
use OCP\Migration\Attributes\CreateTable;
16+
use OCP\Migration\Attributes\DropIndex;
17+
use OCP\Migration\Attributes\IndexType;
18+
use OCP\Migration\IOutput;
19+
use OCP\Migration\SimpleMigrationStep;
20+
use Override;
21+
22+
#[CreateTable(table: 'sharing_classmap')]
23+
#[DropIndex(table: 'share_legacy_mapping', type: IndexType::PRIMARY)]
24+
#[DropIndex(table: 'share_legacy_mapping', type: IndexType::UNIQUE)]
25+
#[AddIndex(table: 'share_legacy_mapping', type: IndexType::PRIMARY)]
26+
#[AddIndex(table: 'share_legacy_mapping', type: IndexType::INDEX)]
27+
class Version35000Date20260813121254 extends SimpleMigrationStep {
28+
#[Override]
29+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
30+
/** @var ISchemaWrapper $schema */
31+
$schema = $schemaClosure();
32+
33+
$shareLegacyMappingTable = $schema->getTable('share_legacy_mapping');
34+
$shareLegacyMappingTable->dropPrimaryKey();
35+
foreach ($shareLegacyMappingTable->getIndexes() as $index) {
36+
$shareLegacyMappingTable->dropIndex($index->getName());
37+
}
38+
39+
$shareLegacyMappingTable->setPrimaryKey(['legacy_provider', 'legacy_id']);
40+
$shareLegacyMappingTable->addIndex(['id']);
41+
42+
return null;
43+
}
44+
}

0 commit comments

Comments
 (0)