1
0

Version30000Date20240906095113.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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. $table = $schema->getTable('taskprocessing_tasks');
  25. $column = $table->getColumn('error_message');
  26. if ($column->getLength() < 4000) {
  27. $column->setLength(4000);
  28. }
  29. return $schema;
  30. }
  31. }