Version30000Date20240708160048.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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: 'scheduled_at', type: ColumnType::INTEGER)]
  19. #[AddColumn(table: 'taskprocessing_tasks', name: 'started_at', type: ColumnType::INTEGER)]
  20. #[AddColumn(table: 'taskprocessing_tasks', name: 'ended_at', type: ColumnType::INTEGER)]
  21. class Version30000Date20240708160048 extends SimpleMigrationStep {
  22. /**
  23. * @param IOutput $output
  24. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  25. * @param array $options
  26. * @return null|ISchemaWrapper
  27. */
  28. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  29. /** @var ISchemaWrapper $schema */
  30. $schema = $schemaClosure();
  31. if ($schema->hasTable('taskprocessing_tasks')) {
  32. $table = $schema->getTable('taskprocessing_tasks');
  33. $table->addColumn('scheduled_at', Types::INTEGER, [
  34. 'notnull' => false,
  35. 'default' => null,
  36. 'unsigned' => true,
  37. ]);
  38. $table->addColumn('started_at', Types::INTEGER, [
  39. 'notnull' => false,
  40. 'default' => null,
  41. 'unsigned' => true,
  42. ]);
  43. $table->addColumn('ended_at', Types::INTEGER, [
  44. 'notnull' => false,
  45. 'default' => null,
  46. 'unsigned' => true,
  47. ]);
  48. return $schema;
  49. }
  50. return null;
  51. }
  52. }