2019-02-12 09:26:46 +01:00
|
|
|
<?php
|
2019-12-03 19:57:53 +01:00
|
|
|
|
2019-02-12 09:26:46 +01:00
|
|
|
declare(strict_types=1);
|
2019-12-03 19:57:53 +01:00
|
|
|
|
2019-02-12 09:26:46 +01:00
|
|
|
/**
|
2024-05-24 19:43:47 +02:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2019-02-12 09:26:46 +01:00
|
|
|
*/
|
|
|
|
namespace OC\Core\Migrations;
|
|
|
|
|
|
|
|
use Closure;
|
|
|
|
use OCP\DB\ISchemaWrapper;
|
2021-01-12 10:20:12 +01:00
|
|
|
use OCP\DB\Types;
|
2019-02-12 09:26:46 +01:00
|
|
|
use OCP\Migration\IOutput;
|
2019-11-22 20:52:10 +01:00
|
|
|
use OCP\Migration\SimpleMigrationStep;
|
2019-02-12 09:26:46 +01:00
|
|
|
|
|
|
|
class Version16000Date20190212081545 extends SimpleMigrationStep {
|
|
|
|
/**
|
|
|
|
* @param IOutput $output
|
|
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
|
|
|
* @param array $options
|
2020-03-06 16:33:01 +01:00
|
|
|
*
|
|
|
|
* @return ISchemaWrapper
|
2019-02-12 09:26:46 +01:00
|
|
|
*/
|
|
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper {
|
|
|
|
/** @var ISchemaWrapper $schema */
|
|
|
|
$schema = $schemaClosure();
|
|
|
|
|
|
|
|
$table = $schema->createTable('login_flow_v2');
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('id', Types::BIGINT, [
|
2019-02-12 09:26:46 +01:00
|
|
|
'autoincrement' => true,
|
|
|
|
'notnull' => true,
|
|
|
|
'length' => 20,
|
|
|
|
'unsigned' => true,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('timestamp', Types::BIGINT, [
|
2019-02-12 09:26:46 +01:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 20,
|
|
|
|
'unsigned' => true,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('started', Types::SMALLINT, [
|
2019-02-12 09:26:46 +01:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 1,
|
|
|
|
'unsigned' => true,
|
|
|
|
'default' => 0,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('poll_token', Types::STRING, [
|
2019-02-12 09:26:46 +01:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 255,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('login_token', Types::STRING, [
|
2019-02-12 09:26:46 +01:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 255,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('public_key', Types::TEXT, [
|
2019-02-12 09:26:46 +01:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 32768,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('private_key', Types::TEXT, [
|
2019-02-12 09:26:46 +01:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 32768,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('client_name', Types::STRING, [
|
2019-02-12 09:26:46 +01:00
|
|
|
'notnull' => true,
|
|
|
|
'length' => 255,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('login_name', Types::STRING, [
|
2019-02-12 09:26:46 +01:00
|
|
|
'notnull' => false,
|
|
|
|
'length' => 255,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('server', Types::STRING, [
|
2019-02-12 09:26:46 +01:00
|
|
|
'notnull' => false,
|
|
|
|
'length' => 255,
|
|
|
|
]);
|
2020-06-30 22:12:06 +02:00
|
|
|
$table->addColumn('app_password', Types::STRING, [
|
2019-02-12 09:26:46 +01:00
|
|
|
'notnull' => false,
|
|
|
|
'length' => 1024,
|
|
|
|
]);
|
|
|
|
$table->setPrimaryKey(['id']);
|
2019-03-27 11:42:33 +01:00
|
|
|
$table->addUniqueIndex(['poll_token'], 'poll_token');
|
|
|
|
$table->addUniqueIndex(['login_token'], 'login_token');
|
|
|
|
$table->addIndex(['timestamp'], 'timestamp');
|
2019-02-12 09:26:46 +01:00
|
|
|
|
|
|
|
return $schema;
|
|
|
|
}
|
|
|
|
}
|