Skip to content

Commit cca6533

Browse files
Merge pull request #65556 from nextcloud/backport/65511/stable32
[stable32] fix(migration): check if deleted_by column exists before trying to add it to files_trash table
2 parents 860eaea + efc341d commit cca6533

1 file changed

Lines changed: 10 additions & 9 deletions

File tree

‎apps/files_trashbin/lib/Migration/Version1020Date20240403003535.php‎

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

30-
if (!$schema->hasTable('files_trash')) {
31-
return null;
30+
if ($schema->hasTable('files_trash')) {
31+
$table = $schema->getTable('files_trash');
32+
if (!$table->hasColumn('deleted_by')) {
33+
$table->addColumn('deleted_by', Types::STRING, [
34+
'notnull' => false,
35+
'length' => 64,
36+
]);
37+
return $schema;
38+
}
3239
}
3340

34-
$table = $schema->getTable('files_trash');
35-
$table->addColumn('deleted_by', Types::STRING, [
36-
'notnull' => false,
37-
'length' => 64,
38-
]);
39-
40-
return $schema;
41+
return null;
4142
}
4243
}

0 commit comments

Comments
 (0)