Passed
Push — master ( 3c693d...ccd5ca )
by Roeland
28:56 queued 14:09
created

Version13000Date20170919121250   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 58
c 1
b 0
f 0
dl 0
loc 99
rs 10
wmc 4

3 Methods

Rating   Name   Duplication   Size   Complexity  
A preSchemaChange() 0 1 1
B changeSchema() 0 72 2
A postSchemaChange() 0 1 1
1
<?php
2
/**
3
 *
4
 *
5
 * @author Joas Schilling <[email protected]>
6
 * @author Morris Jobke <[email protected]>
7
 * @author Roeland Jago Douma <[email protected]>
8
 *
9
 * @license GNU AGPL version 3 or any later version
10
 *
11
 * This program is free software: you can redistribute it and/or modify
12
 * it under the terms of the GNU Affero General Public License as
13
 * published by the Free Software Foundation, either version 3 of the
14
 * License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU Affero General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU Affero General Public License
22
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
 *
24
 */
25
26
namespace OC\Core\Migrations;
27
28
use OCP\DB\ISchemaWrapper;
29
use OCP\Migration\IOutput;
30
use OCP\Migration\SimpleMigrationStep;
31
32
/**
33
 * Auto-generated migration step: Please modify to your needs!
34
 */
35
class Version13000Date20170919121250 extends SimpleMigrationStep {
36
37
	/**
38
	 * @param IOutput $output
39
	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
40
	 * @param array $options
41
	 * @since 13.0.0
42
	 */
43
	public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
44
	}
45
46
	/**
47
	 * @param IOutput $output
48
	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
49
	 * @param array $options
50
	 * @return null|ISchemaWrapper
51
	 * @since 13.0.0
52
	 */
53
	public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) {
54
		/** @var ISchemaWrapper $schema */
55
		$schema = $schemaClosure();
56
57
		$table = $schema->getTable('jobs');
58
		$column = $table->getColumn('id');
59
		$column->setUnsigned(true);
60
61
		$table = $schema->getTable('authtoken');
62
		$column = $table->getColumn('id');
63
		$column->setUnsigned(true);
64
		$column = $table->getColumn('type');
65
		$column->setUnsigned(true);
66
		if ($table->hasColumn('remember')) {
67
			$column = $table->getColumn('remember');
68
			$column->setUnsigned(true);
69
		} else {
70
			$table->addColumn('remember', 'smallint', [
71
				'notnull' => false,
72
				'length' => 1,
73
				'default' => 0,
74
				'unsigned' => true,
75
			]);
76
		}
77
		$column = $table->getColumn('last_activity');
78
		$column->setUnsigned(true);
79
		$column = $table->getColumn('last_check');
80
		$column->setUnsigned(true);
81
82
		$table = $schema->getTable('bruteforce_attempts');
83
		$column = $table->getColumn('id');
84
		$column->setUnsigned(true);
85
		$column = $table->getColumn('occurred');
86
		$column->setUnsigned(true);
87
88
		$table = $schema->getTable('comments');
89
		$column = $table->getColumn('id');
90
		$column->setUnsigned(true);
91
		$column = $table->getColumn('parent_id');
92
		$column->setUnsigned(true);
93
		$column = $table->getColumn('topmost_parent_id');
94
		$column->setUnsigned(true);
95
		$column = $table->getColumn('children_count');
96
		$column->setUnsigned(true);
97
98
		$table = $schema->getTable('file_locks');
99
		$column = $table->getColumn('id');
100
		$column->setUnsigned(true);
101
102
		$table = $schema->getTable('systemtag');
103
		$column = $table->getColumn('id');
104
		$column->setUnsigned(true);
105
106
		$table = $schema->getTable('systemtag_object_mapping');
107
		$column = $table->getColumn('systemtagid');
108
		$column->setUnsigned(true);
109
110
		$table = $schema->getTable('systemtag_group');
111
		$column = $table->getColumn('systemtagid');
112
		$column->setUnsigned(true);
113
114
		$table = $schema->getTable('vcategory');
115
		$column = $table->getColumn('id');
116
		$column->setUnsigned(true);
117
118
		$table = $schema->getTable('vcategory_to_object');
119
		$column = $table->getColumn('objid');
120
		$column->setUnsigned(true);
121
		$column = $table->getColumn('categoryid');
122
		$column->setUnsigned(true);
123
124
		return $schema;
125
	}
126
127
	/**
128
	 * @param IOutput $output
129
	 * @param \Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
130
	 * @param array $options
131
	 * @since 13.0.0
132
	 */
133
	public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
134
	}
135
}
136