aboutsummaryrefslogtreecommitdiffstats
path: root/core/Migrations/Version27000Date20220613163520.php
blob: 4a5601b6cd527427e87457655ce172bbd972f020 (plain)
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
<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */

namespace OC\Core\Migrations;

use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;

class Version27000Date20220613163520 extends SimpleMigrationStep {
	public function name(): string {
		return 'Add mountpoint path to mounts table unique index';
	}

	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
		/** @var ISchemaWrapper $schema */
		$schema = $schemaClosure();

		$table = $schema->getTable('mounts');
		if ($table->hasIndex('mounts_user_root_index')) {
			$table->dropIndex('mounts_user_root_index');
			// new index gets added with "add missing indexes"
		}

		return $schema;
	}
}