Completed
Pull Request — master (#384)
by Tortue
02:31
created

Version0017Date20200221173726   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A changeSchema() 0 15 1
1
<?php
2
/**
3
 * Circles - Bring cloud-users closer together.
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Maxence Lange <[email protected]>
9
 * @copyright 2019
10
 * @license GNU AGPL version 3 or any later version
11
 *
12
 * This program is free software: you can redistribute it and/or modify
13
 * it under the terms of the GNU Affero General Public License as
14
 * published by the Free Software Foundation, either version 3 of the
15
 * License, or (at your option) any later version.
16
 *
17
 * This program is distributed in the hope that it will be useful,
18
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20
 * GNU Affero General Public License for more details.
21
 *
22
 * You should have received a copy of the GNU Affero General Public License
23
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
24
 *
25
 */
26
27
declare(strict_types=1);
28
29
namespace OCA\Circles\Migration;
30
31
use Closure;
32
use Doctrine\DBAL\Schema\SchemaException;
33
use Doctrine\DBAL\Types\Type;
34
use OCP\DB\ISchemaWrapper;
35
use OCP\IDBConnection;
36
use OCP\Migration\IOutput;
37
use OCP\Migration\SimpleMigrationStep;
38
39
/**
40
 * Auto-generated migration step: Please modify to your needs!
41
 */
42
class Version0017Date20200221173726 extends SimpleMigrationStep {
43
44
45
	/** @var IDBConnection */
46
	private $connection;
47
48
49
	/**
50
	 * @param IDBConnection $connection
51
	 */
52
	public function __construct(IDBConnection $connection) {
53
		$this->connection = $connection;
54
	}
55
56
57
	/**
58
	 * @param IOutput $output
59
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
60
	 * @param array $options
61
	 *
62
	 * @return null|ISchemaWrapper
63
	 * @throws SchemaException
64
	 */
65
	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
66
		/** @var ISchemaWrapper $schema */
67
		$schema = $schemaClosure();
68
69
		$table = $schema->getTable('circles_circles');
70
		$table->addColumn(
71
			'group_id', 'string', [
72
						   'notnull' => false,
73
						   'default' => '',
74
						   'length'  => 64,
75
					   ]
76
		);
77
78
		return $schema;
79
	}
80
81
}
82