Skip to content

Commit 812a9d8

Browse files
authored
Merge pull request #1350 from nextcloud/fix/face-vector-migration
fix(Migration): Don't create empty notnull column
2 parents 73cbb9f + e79f8eb commit 812a9d8

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

lib/Migration/Version010000001Date20250727094721.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
3838
$table = $schema->getTable('recognize_face_detections');
3939
if (!$table->hasColumn('face_vector')) {
4040
$table->addColumn('face_vector', Types::TEXT, [
41-
'notnull' => true,
41+
'notnull' => false,
4242
]);
4343
return $schema;
4444
}

lib/Migration/Version010000001Date20250727094821.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,20 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt
2727
/** @var ISchemaWrapper $schema */
2828
$schema = $schemaClosure();
2929

30+
$changed = false;
3031
if ($schema->hasTable('recognize_face_detections')) {
3132
$table = $schema->getTable('recognize_face_detections');
3233
if ($table->hasColumn('vector')) {
3334
$table->dropColumn('vector');
34-
return $schema;
35+
$changed = true;
36+
}
37+
if ($table->hasColumn('face_vector')) {
38+
$table->modifyColumn('face_vector', [
39+
'notnull' => true,
40+
]);
41+
$changed = true;
3542
}
3643
}
37-
return null;
44+
return $changed ? $schema : null;
3845
}
3946
}

0 commit comments

Comments
 (0)