36 lines
868 B
PHP
36 lines
868 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2024 F7cloud GmbH and F7cloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace OCA\GroupFolders\Migration;
|
|
|
|
use Closure;
|
|
use OCP\DB\ISchemaWrapper;
|
|
use OCP\Migration\IOutput;
|
|
use OCP\Migration\SimpleMigrationStep;
|
|
|
|
class Version19000Date20241029123147 extends SimpleMigrationStep {
|
|
/**
|
|
* @param Closure(): ISchemaWrapper $schemaClosure
|
|
*/
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
|
/** @var ISchemaWrapper $schema */
|
|
$schema = $schemaClosure();
|
|
|
|
if ($schema->hasTable('group_folders')) {
|
|
$table = $schema->getTable('group_folders');
|
|
if (!$table->hasIndex('gf_folders_folder_id')) {
|
|
$table->addUniqueIndex(['folder_id'], 'gf_folders_folder_id');
|
|
return $schema;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|