0
0
mirror of https://github.com/nextcloud/server.git synced 2024-12-29 16:38:28 +00:00
nextcloud_server/apps/files_trashbin/lib/Migration/Version1020Date20240403003535.php
Maxence Lange 5e1196095c feat(migrations): add metadata to existing migrations
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
2024-08-02 18:26:12 -01:00

43 lines
1.0 KiB
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;
#[AddColumn(table: 'files_trash', name: 'deleted_by', type: ColumnType::STRING)]
class Version1020Date20240403003535 extends SimpleMigrationStep {
/**
* @param Closure(): ISchemaWrapper $schemaClosure
*/
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;
}
}