Skip to content

Commit 27995fb

Browse files
authored
Merge pull request #3390 from nextcloud/perf/group_folders-table-index
perf: Add index for group_folders table
2 parents f31ec85 + 60ff84c commit 27995fb

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

appinfo/info.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Folders can be configured from *Group folders* in the admin settings.
1313
1414
After a folder is created, the admin can give access to the folder to one or more groups, control their write/sharing permissions and assign a quota for the folder.
1515
]]></description>
16-
<version>19.0.0-dev.3</version>
16+
<version>19.0.0-dev.4</version>
1717
<licence>agpl</licence>
1818
<author>Robin Appelman</author>
1919
<namespace>GroupFolders</namespace>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCA\GroupFolders\Migration;
11+
12+
use Closure;
13+
use OCP\DB\ISchemaWrapper;
14+
use OCP\Migration\IOutput;
15+
use OCP\Migration\SimpleMigrationStep;
16+
17+
class Version19000Date20241029123147 extends SimpleMigrationStep {
18+
/**
19+
* @param Closure(): ISchemaWrapper $schemaClosure
20+
*/
21+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
22+
/** @var ISchemaWrapper $schema */
23+
$schema = $schemaClosure();
24+
25+
if ($schema->hasTable('group_folders')) {
26+
$table = $schema->getTable('group_folders');
27+
if (!$table->hasIndex('gf_folders_folder_id')) {
28+
$table->addUniqueIndex(['folder_id'], 'gf_folders_folder_id');
29+
return $schema;
30+
}
31+
}
32+
33+
return null;
34+
}
35+
}

0 commit comments

Comments
 (0)