Completed
Push — master ( b8492c...7ef722 )
by Blizzz
158:19 queued 134:06
created

Version14000Date20180518120534   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 1
lcom 0
cbo 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A changeSchema() 0 21 1
1
<?php
2
declare(strict_types=1);
3
/**
4
 * @copyright Copyright (c) 2018 Roeland Jago Douma <[email protected]>
5
 *
6
 * @author Roeland Jago Douma <[email protected]>
7
 *
8
 * @license GNU AGPL version 3 or any later version
9
 *
10
 * This program is free software: you can redistribute it and/or modify
11
 * it under the terms of the GNU Affero General Public License as
12
 * published by the Free Software Foundation, either version 3 of the
13
 * License, or (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU Affero General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU Affero General Public License
21
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
22
 *
23
 */
24
25
namespace OC\Core\Migrations;
26
27
use OCP\DB\ISchemaWrapper;
28
use OCP\Migration\SimpleMigrationStep;
29
use OCP\Migration\IOutput;
30
31
class Version14000Date20180518120534 extends SimpleMigrationStep {
32
33
	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
34
		/** @var ISchemaWrapper $schema */
35
		$schema = $schemaClosure();
36
37
		$table = $schema->getTable('authtoken');
38
		$table->addColumn('private_key', 'text', [
39
			'notnull' => false,
40
		]);
41
		$table->addColumn('public_key', 'text', [
42
			'notnull' => false,
43
		]);
44
		$table->addColumn('version', 'smallint', [
45
			'notnull' => true,
46
			'default' => 1,
47
			'unsigned' => true,
48
		]);
49
		$table->addIndex(['uid'], 'authtoken_uid_index');
50
		$table->addIndex(['version'], 'authtoken_version_index');
51
52
		return $schema;
53
	}
54
}
55