1
0

Version31000Date20240821142813.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  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 OCA\Files_Sharing\Migration;
  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. #[AddColumn(table: 'share', name: 'reminder_sent', type: ColumnType::BOOLEAN)]
  16. class Version31000Date20240821142813 extends SimpleMigrationStep {
  17. /**
  18. * @param IOutput $output
  19. * @param Closure(): ISchemaWrapper $schemaClosure
  20. * @param array $options
  21. * @return null|ISchemaWrapper
  22. */
  23. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  24. $schema = $schemaClosure();
  25. $table = $schema->getTable('share');
  26. if ($table->hasColumn('reminder_sent')) {
  27. return null;
  28. }
  29. $table->addColumn('reminder_sent', Types::BOOLEAN, [
  30. 'notnull' => false,
  31. 'default' => false,
  32. ]);
  33. return $schema;
  34. }
  35. }