-
Notifications
You must be signed in to change notification settings - Fork 61
Expand file tree
/
Copy pathVersion010000001Date20250727094821.php
More file actions
46 lines (41 loc) · 1.21 KB
/
Version010000001Date20250727094821.php
File metadata and controls
46 lines (41 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
/*
* Copyright (c) 2020-2025 The Recognize contributors.
* This file is licensed under the Affero General Public License version 3 or later. See the COPYING file.
*/
declare(strict_types=1);
namespace OCA\Recognize\Migration;
use Closure;
use Doctrine\DBAL\Schema\SchemaException;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
final class Version010000001Date20250727094821 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
* @param array $options
*
* @return ?ISchemaWrapper
* @throws SchemaException
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
$changed = false;
if ($schema->hasTable('recognize_face_detections')) {
$table = $schema->getTable('recognize_face_detections');
if ($table->hasColumn('vector')) {
$table->dropColumn('vector');
$changed = true;
}
if ($table->hasColumn('face_vector')) {
$table->modifyColumn('face_vector', [
'notnull' => true,
]);
$changed = true;
}
}
return $changed ? $schema : null;
}
}