Passed
Push — master ( 9e596d...9f70c6 )
by Christoph
15:44 queued 10s
created

Version1018Date20210312100735::changeSchema()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 16

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 16
nc 1
nop 3
dl 0
loc 23
rs 9.7333
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace OCA\DAV\Migration;
6
7
use Closure;
8
use OCP\DB\ISchemaWrapper;
9
use OCP\DB\Types;
10
use OCP\Migration\IOutput;
11
use OCP\Migration\SimpleMigrationStep;
12
13
class Version1018Date20210312100735 extends SimpleMigrationStep {
14
15
	/**
16
	 * @param IOutput $output
17
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
18
	 * @param array $options
19
	 * @return ISchemaWrapper
20
	 */
21
	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
22
		/** @var ISchemaWrapper $schema */
23
		$schema = $schemaClosure();
24
25
		$calendarsTable = $schema->getTable('calendars');
26
		$calendarsTable->addColumn('deleted_at', Types::INTEGER, [
27
			'notnull' => false,
28
			'length' => 4,
29
			'unsigned' => true,
30
		]);
31
		$calendarsTable->addIndex([
32
			'principaluri',
33
			'deleted_at',
34
		], 'cals_princ_del_idx');
35
36
		$calendarObjectsTable = $schema->getTable('calendarobjects');
37
		$calendarObjectsTable->addColumn('deleted_at', Types::INTEGER, [
38
			'notnull' => false,
39
			'length' => 4,
40
			'unsigned' => true,
41
		]);
42
43
		return $schema;
44
	}
45
}
46