Skip to content

Commit 9315c89

Browse files
authored
Merge pull request #1600 from nextcloud/carl/add-missing-index
fix: Add missing index on email the guest_users table
2 parents 2c5cbd5 + 2c6b484 commit 9315c89

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
Guests accounts can be created from the share menu by entering either the recipients email or name and choosing "create guest account", once the share is created the guest user will receive an email notification about the mail with a link to set their password.
1515
1616
Guests users can only access files shared to them and cannot create any files outside of shares, additionally, the apps accessible to guest accounts are whitelisted.]]></description>
17-
<version>4.8.0-dev.0</version>
17+
<version>4.8.0-dev.1</version>
1818
<licence>agpl</licence>
1919
<author>Nextcloud</author>
2020
<types>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCA\Guests\Migration;
11+
12+
use Closure;
13+
use OCP\DB\ISchemaWrapper;
14+
use OCP\IDBConnection;
15+
use OCP\Migration\Attributes\AddIndex;
16+
use OCP\Migration\Attributes\IndexType;
17+
use OCP\Migration\IOutput;
18+
use OCP\Migration\SimpleMigrationStep;
19+
20+
#[AddIndex(table: 'guests_users', type: IndexType::INDEX, description: 'Add missing index')]
21+
class Version4008Date20260609101600 extends SimpleMigrationStep {
22+
public function __construct(
23+
protected IDBConnection $db,
24+
) {
25+
}
26+
27+
/**
28+
* @param Closure(): ISchemaWrapper $schemaClosure
29+
*/
30+
#[\Override]
31+
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
32+
/** @var ISchemaWrapper $schema */
33+
$schema = $schemaClosure();
34+
35+
$table = $schema->getTable('guests_users');
36+
if ($table->hasIndex('guests_users_email')) {
37+
return null;
38+
}
39+
40+
$table->addIndex(['email'], 'guests_users_email');
41+
return $schema;
42+
}
43+
}

0 commit comments

Comments
 (0)