Version27000Date20220613163520.php 862 B

12345678910111213141516171819202122232425262728293031323334
  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 OC\Core\Migrations;
  8. use Closure;
  9. use OCP\DB\ISchemaWrapper;
  10. use OCP\Migration\IOutput;
  11. use OCP\Migration\SimpleMigrationStep;
  12. class Version27000Date20220613163520 extends SimpleMigrationStep {
  13. public function name(): string {
  14. return 'Add mountpoint path to mounts table unique index';
  15. }
  16. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  17. /** @var ISchemaWrapper $schema */
  18. $schema = $schemaClosure();
  19. $table = $schema->getTable('mounts');
  20. if ($table->hasIndex('mounts_user_root_index')) {
  21. $table->dropIndex('mounts_user_root_index');
  22. // new index gets added with "add missing indexes"
  23. }
  24. return $schema;
  25. }
  26. }