|
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
|
|
|
/** |
|
15
|
|
|
* Auto-generated migration step: Please modify to your needs! |
|
16
|
|
|
*/ |
|
17
|
|
|
class Version0870Date20211124181937 extends SimpleMigrationStep { |
|
18
|
|
|
|
|
19
|
|
|
private $connection; |
|
20
|
|
|
|
|
21
|
|
|
public function __construct(IDBConnection $connection) { |
|
22
|
|
|
$this->connection = $connection; |
|
23
|
|
|
} |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* @param IOutput $output |
|
27
|
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
28
|
|
|
* @param array $options |
|
29
|
|
|
*/ |
|
30
|
|
|
public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param IOutput $output |
|
35
|
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
36
|
|
|
* @param array $options |
|
37
|
|
|
* @return null|ISchemaWrapper |
|
38
|
|
|
*/ |
|
39
|
|
|
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { |
|
40
|
|
|
$schema = $schemaClosure(); |
|
41
|
|
|
$table = $schema->getTable('facerecog_faces'); |
|
42
|
|
|
if (!$table->hasColumn('is_groupable')) { |
|
43
|
|
|
$table->addColumn('is_groupable', 'boolean', [ |
|
44
|
|
|
'notnull' => false, |
|
45
|
|
|
'default' => true, |
|
46
|
|
|
]); |
|
47
|
|
|
} |
|
48
|
|
|
$table = $schema->getTable('facerecog_persons'); |
|
49
|
|
|
if (!$table->hasColumn('is_visible')) { |
|
50
|
|
|
$table->addColumn('is_visible', 'boolean', [ |
|
51
|
|
|
'notnull' => false, |
|
52
|
|
|
'default' => true, |
|
53
|
|
|
]); |
|
54
|
|
|
} |
|
55
|
|
|
return $schema; |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @param IOutput $output |
|
60
|
|
|
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper` |
|
61
|
|
|
* @param array $options |
|
62
|
|
|
*/ |
|
63
|
|
|
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
} |
|
67
|
|
|
|