Version30000Date20240717111406.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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\DB\Types;
  11. use OCP\Migration\Attributes\AddColumn;
  12. use OCP\Migration\Attributes\ColumnType;
  13. use OCP\Migration\IOutput;
  14. use OCP\Migration\SimpleMigrationStep;
  15. /**
  16. *
  17. */
  18. #[AddColumn(table: 'taskprocessing_tasks', name: 'webhook_uri', type: ColumnType::STRING)]
  19. #[AddColumn(table: 'taskprocessing_tasks', name: 'webhook_method', type: ColumnType::STRING)]
  20. class Version30000Date20240717111406 extends SimpleMigrationStep {
  21. /**
  22. * @param IOutput $output
  23. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  24. * @param array $options
  25. * @return null|ISchemaWrapper
  26. */
  27. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  28. /** @var ISchemaWrapper $schema */
  29. $schema = $schemaClosure();
  30. if ($schema->hasTable('taskprocessing_tasks')) {
  31. $table = $schema->getTable('taskprocessing_tasks');
  32. $table->addColumn('webhook_uri', Types::STRING, [
  33. 'notnull' => false,
  34. 'default' => null,
  35. 'length' => 4000,
  36. ]);
  37. $table->addColumn('webhook_method', Types::STRING, [
  38. 'notnull' => false,
  39. 'default' => null,
  40. 'length' => 64,
  41. ]);
  42. return $schema;
  43. }
  44. return null;
  45. }
  46. }