1
0

Version28000Date20231103104802.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 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\IOutput;
  12. use OCP\Migration\SimpleMigrationStep;
  13. /**
  14. * Introduce completion_expected_at column in textprocessing_tasks table
  15. */
  16. class Version28000Date20231103104802 extends SimpleMigrationStep {
  17. /**
  18. * @param IOutput $output
  19. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  20. * @param array $options
  21. * @return null|ISchemaWrapper
  22. */
  23. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  24. /** @var ISchemaWrapper $schema */
  25. $schema = $schemaClosure();
  26. if ($schema->hasTable('textprocessing_tasks')) {
  27. $table = $schema->getTable('textprocessing_tasks');
  28. if (!$table->hasColumn('completion_expected_at')) {
  29. $table->addColumn('completion_expected_at', Types::DATETIME, [
  30. 'notnull' => false,
  31. ]);
  32. return $schema;
  33. }
  34. }
  35. return null;
  36. }
  37. }