Version0910Date20221109096049   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 41
ccs 0
cts 14
cp 0
rs 10
wmc 6

4 Methods

Rating   Name   Duplication   Size   Complexity  
A changeSchema() 0 11 3
A __construct() 0 2 1
A postSchemaChange() 0 1 1
A preSchemaChange() 0 1 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace OCA\FaceRecognition\Migration;
6
7
use Closure;
8
use OCP\DB\ISchemaWrapper;
9
use OCP\Migration\IOutput;
10
use OCP\Migration\SimpleMigrationStep;
11
12
use OCP\IDBConnection;
13
14
class Version0910Date20221109096049 extends SimpleMigrationStep {
15
16
	private $connection;
17
18
	public function __construct(IDBConnection $connection) {
19
		$this->connection = $connection;
20
	}
21
22
	/**
23
	 * @param IOutput $output
24
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
25
	 * @param array $options
26
	 */
27
	public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
28
	}
29
30
	/**
31
	 * @param IOutput $output
32
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
33
	 * @param array $options
34
	 * @return null|ISchemaWrapper
35
	 */
36
	public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
37
		$schema = $schemaClosure();
38
39
		$table = $schema->getTable('facerecog_faces');
40
		if ($table->hasColumn('width') && $table->hasColumn('left')) {
41
			$table->dropColumn('left');
42
			$table->dropColumn('top');
43
			$table->dropColumn('right');
44
			$table->dropColumn('bottom');
45
		}
46
		return $schema;
47
	}
48
49
	/**
50
	 * @param IOutput $output
51
	 * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
52
	 * @param array $options
53
	 */
54
	public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void {
55
	}
56
57
}
58