Passed
Push — master ( 692da9...451f70 )
by Robin
13:23 queued 15s
created

Version240000Date20220202150027   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
dl 0
loc 20
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A changeSchema() 0 13 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace OC\Core\Migrations;
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
/**
14
 * Auto-generated migration step: Please modify to your needs!
15
 */
16
class Version240000Date20220202150027 extends SimpleMigrationStep {
17
	/**
18
	 * @param IOutput $output
19
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
20
	 * @param array $options
21
	 * @return null|ISchemaWrapper
22
	 */
23
	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
24
		/** @var ISchemaWrapper $schema */
25
		$schema = $schemaClosure();
26
27
		$table = $schema->getTable('mounts');
28
		if (!$table->hasColumn('mount_provider_class')) {
29
			$table->addColumn('mount_provider_class', Types::STRING, [
30
				'notnull' => false,
31
				'length' => 128,
32
			]);
33
			return $schema;
34
		}
35
		return null;
36
	}
37
}
38