mirror of
https://github.com/nextcloud/server.git
synced 2026-06-27 17:40:37 -04:00
Co-authored-by: Micke Nordin <kano@sunet.se> Signed-off-by: Micke Nordin <kano@sunet.se> Signed-off-by: Enrique Pérez Arnaud <enrique@cazalla.net>
54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace OCA\CloudFederationAPI\Migration;
|
|
|
|
use Closure;
|
|
use OCP\DB\ISchemaWrapper;
|
|
use OCP\DB\Types;
|
|
use OCP\Migration\Attributes\CreateTable;
|
|
use OCP\Migration\IOutput;
|
|
use OCP\Migration\SimpleMigrationStep;
|
|
|
|
#[CreateTable(table: 'ocm_token_map', description: 'Maps OCM access tokens to their originating refresh tokens')]
|
|
class Version1017Date20260306120000 extends SimpleMigrationStep {
|
|
#[\Override]
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
|
|
/** @var ISchemaWrapper $schema */
|
|
$schema = $schemaClosure();
|
|
|
|
if ($schema->hasTable('ocm_token_map')) {
|
|
return null;
|
|
}
|
|
|
|
$table = $schema->createTable('ocm_token_map');
|
|
$table->addColumn('id', Types::INTEGER, [
|
|
'autoincrement' => true,
|
|
'notnull' => true,
|
|
'unsigned' => true,
|
|
]);
|
|
$table->addColumn('access_token_id', Types::INTEGER, [
|
|
'notnull' => true,
|
|
'unsigned' => true,
|
|
]);
|
|
$table->addColumn('refresh_token', Types::STRING, [
|
|
'notnull' => true,
|
|
'length' => 512,
|
|
]);
|
|
$table->addColumn('expires', Types::INTEGER, [
|
|
'notnull' => true,
|
|
]);
|
|
|
|
$table->setPrimaryKey(['id']);
|
|
$table->addIndex(['access_token_id'], 'ocm_tkmap_atid');
|
|
$table->addIndex(['expires'], 'ocm_tkmap_exp');
|
|
|
|
return $schema;
|
|
}
|
|
}
|