Version1029Date20221114151721.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\DAV\Migration;
  8. use Closure;
  9. use Doctrine\DBAL\Schema\SchemaException;
  10. use OCP\DB\ISchemaWrapper;
  11. use OCP\Migration\IOutput;
  12. use OCP\Migration\SimpleMigrationStep;
  13. class Version1029Date20221114151721 extends SimpleMigrationStep {
  14. /**
  15. * @param IOutput $output
  16. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  17. * @param array $options
  18. * @return null|ISchemaWrapper
  19. * @throws SchemaException
  20. */
  21. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  22. /** @var ISchemaWrapper $schema */
  23. $schema = $schemaClosure();
  24. $calendarObjectsTable = $schema->getTable('calendarobjects');
  25. if (!$calendarObjectsTable->hasIndex('calobj_clssfction_index')) {
  26. $calendarObjectsTable->addIndex(['classification'], 'calobj_clssfction_index');
  27. return $schema;
  28. }
  29. return null;
  30. }
  31. }