0
0
mirror of https://github.com/nextcloud/server.git synced 2024-12-29 16:38:28 +00:00
nextcloud_server/apps/files_sharing/lib/Migration/Version31000Date20240821142813.php
Ferdinand Thiessen 1ea902a195
chore(files_sharing): Add migration attribute for share.reminder_sent column
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
2024-09-06 14:46:33 +02:00

44 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_Sharing\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: 'share', name: 'reminder_sent', type: ColumnType::BOOLEAN)]
class Version31000Date20240821142813 extends SimpleMigrationStep {
/**
* @param IOutput $output
* @param Closure(): ISchemaWrapper $schemaClosure
* @param array $options
* @return null|ISchemaWrapper
*/
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
$schema = $schemaClosure();
$table = $schema->getTable('share');
if ($table->hasColumn('reminder_sent')) {
return null;
}
$table->addColumn('reminder_sent', Types::BOOLEAN, [
'notnull' => false,
'default' => false,
]);
return $schema;
}
}