nextcloud/apps/files_trashbin/lib/Migration/Version1020Date20240403003535.php
Carl Schwan f6c839d125
refactor(psalm): Modernize migration doc
And remove all the duplication in the subclasses

Signed-off-by: Carl Schwan <carlschwan@kde.org>
2026-02-12 11:25:55 +01:00

40 lines
989 B
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Files_Trashbin\Migration;
use Closure;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\Attributes\AddColumn;
use OCP\Migration\Attributes\ColumnType;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
use Override;
#[AddColumn(table: 'files_trash', name: 'deleted_by', type: ColumnType::STRING)]
class Version1020Date20240403003535 extends SimpleMigrationStep {
#[Override]
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if (!$schema->hasTable('files_trash')) {
return null;
}
$table = $schema->getTable('files_trash');
$table->addColumn('deleted_by', Types::STRING, [
'notnull' => false,
'length' => 64,
]);
return $schema;
}
}