Version30000Date20240906095113.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OC\Core\Migrations;
  8. use Closure;
  9. use OCP\DB\ISchemaWrapper;
  10. use OCP\Migration\Attributes\ModifyColumn;
  11. use OCP\Migration\IOutput;
  12. use OCP\Migration\SimpleMigrationStep;
  13. #[ModifyColumn(table: 'taskprocessing_tasks', name: 'error_message', description: 'Increase column length to 4000 bytes to support longer error messages')]
  14. class Version30000Date20240906095113 extends SimpleMigrationStep {
  15. /**
  16. * @param IOutput $output
  17. * @param Closure(): ISchemaWrapper $schemaClosure
  18. * @param array $options
  19. * @return null|ISchemaWrapper
  20. */
  21. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  22. /** @var ISchemaWrapper $schema */
  23. $schema = $schemaClosure();
  24. if ($schema->hasTable('taskprocessing_tasks')) {
  25. $table = $schema->getTable('taskprocessing_tasks');
  26. $column = $table->getColumn('error_message');
  27. if ($column->getLength() < 4000) {
  28. $column->setLength(4000);
  29. }
  30. }
  31. return $schema;
  32. }
  33. }