2018-05-22 02:52:16 -04:00
|
|
|
<?php
|
2019-12-03 13:57:53 -05:00
|
|
|
|
2018-06-25 01:38:52 -04:00
|
|
|
declare(strict_types=1);
|
2018-05-22 02:52:16 -04:00
|
|
|
|
|
|
|
|
/**
|
2024-05-24 13:43:47 -04:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2018-05-22 02:52:16 -04:00
|
|
|
*/
|
|
|
|
|
namespace OC\Core\Migrations;
|
|
|
|
|
|
|
|
|
|
use Closure;
|
|
|
|
|
use OCP\DB\ISchemaWrapper;
|
|
|
|
|
use OCP\Migration\IOutput;
|
|
|
|
|
use OCP\Migration\SimpleMigrationStep;
|
|
|
|
|
|
|
|
|
|
class Version14000Date20180522074438 extends SimpleMigrationStep {
|
|
|
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure,
|
|
|
|
|
array $options): ISchemaWrapper {
|
|
|
|
|
$schema = $schemaClosure();
|
|
|
|
|
|
|
|
|
|
if (!$schema->hasTable('twofactor_providers')) {
|
|
|
|
|
$table = $schema->createTable('twofactor_providers');
|
|
|
|
|
$table->addColumn('provider_id', 'string',
|
|
|
|
|
[
|
|
|
|
|
'notnull' => true,
|
|
|
|
|
'length' => 32,
|
|
|
|
|
]);
|
|
|
|
|
$table->addColumn('uid', 'string',
|
|
|
|
|
[
|
|
|
|
|
'notnull' => true,
|
|
|
|
|
'length' => 64,
|
|
|
|
|
]);
|
|
|
|
|
$table->addColumn('enabled', 'smallint',
|
|
|
|
|
[
|
|
|
|
|
'notnull' => true,
|
|
|
|
|
'length' => 1,
|
|
|
|
|
]);
|
|
|
|
|
$table->setPrimaryKey(['provider_id', 'uid']);
|
2018-12-21 07:02:25 -05:00
|
|
|
$table->addIndex(['uid'], 'twofactor_providers_uid');
|
2018-05-22 02:52:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $schema;
|
|
|
|
|
}
|
|
|
|
|
}
|