nextcloud/core/Migrations/Version34000Date20260318095645.php
Maksim Sukharev 96e24b3da0 fix(bg_jobs): store job argument as a text, increase length cap from 4000 to 32000
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
2026-03-19 11:38:40 +01:00

41 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OC\Core\Migrations;
use Closure;
use Doctrine\DBAL\Types\Type;
use OCP\DB\ISchemaWrapper;
use OCP\DB\Types;
use OCP\Migration\Attributes\ColumnType;
use OCP\Migration\Attributes\ModifyColumn;
use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
use Override;
#[ModifyColumn(table: 'jobs', name: 'argument', type: ColumnType::TEXT, description: 'Migrate background job arguments to a text column')]
class Version34000Date20260318095645 extends SimpleMigrationStep {
#[Override]
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
if ($schema->hasTable('jobs')) {
$table = $schema->getTable('jobs');
$argumentColumn = $table->getColumn('argument');
if ($argumentColumn->getType() !== Type::getType(Types::TEXT)) {
$argumentColumn->setType(Type::getType(Types::TEXT));
return $schema;
}
}
return null;
}
}