0
0
Fork 0
mirror of https://github.com/nextcloud/server.git synced 2025-02-07 09:59:46 +00:00
nextcloud_server/apps/oauth2/lib/Migration/Version010402Date20190107124745.php
Andy Scherzinger cc1686dba9
chore: Add SPDX header
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
2024-05-31 10:38:47 +02:00

36 lines
1 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\OAuth2\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version010402Date20190107124745 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
// During an ownCloud migration, the client_identifier column identifier might not exist yet.
if ($schema->getTable('oauth2_clients')->hasColumn('client_identifier')) {
$table = $schema->getTable('oauth2_clients');
$table->dropIndex('oauth2_client_id_idx');
$table->addUniqueIndex(['client_identifier'], 'oauth2_client_id_idx');
return $schema;
}
}
}