Version1008Date20181114084440.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 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 OCP\DB\ISchemaWrapper;
  10. use OCP\Migration\IOutput;
  11. use OCP\Migration\SimpleMigrationStep;
  12. class Version1008Date20181114084440 extends SimpleMigrationStep {
  13. /**
  14. * @param IOutput $output
  15. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  16. * @param array $options
  17. * @return null|ISchemaWrapper
  18. */
  19. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
  20. /** @var ISchemaWrapper $schema */
  21. $schema = $schemaClosure();
  22. if ($schema->hasTable('calendarchanges')) {
  23. $calendarChangesTable = $schema->getTable('calendarchanges');
  24. if ($calendarChangesTable->hasIndex('calendarid_calendartype_synctoken')) {
  25. $calendarChangesTable->dropIndex('calendarid_calendartype_synctoken');
  26. }
  27. if (!$calendarChangesTable->hasIndex('calid_type_synctoken')) {
  28. $calendarChangesTable->addIndex(['calendarid', 'calendartype', 'synctoken'], 'calid_type_synctoken');
  29. }
  30. }
  31. return $schema;
  32. }
  33. }