Version22000Date20210216084416.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\Files_External\Migration;
  8. use Closure;
  9. use OCP\DB\ISchemaWrapper;
  10. use OCP\Migration\IOutput;
  11. use OCP\Migration\SimpleMigrationStep;
  12. /**
  13. * Auto-generated migration step: Please modify to your needs!
  14. */
  15. class Version22000Date20210216084416 extends SimpleMigrationStep {
  16. /**
  17. * @param IOutput $output
  18. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  19. * @param array $options
  20. * @return null|ISchemaWrapper
  21. */
  22. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  23. /** @var ISchemaWrapper $schema */
  24. $schema = $schemaClosure();
  25. $table = $schema->getTable('external_applicable');
  26. if ($table->hasIndex('applicable_type_value')) {
  27. $table->dropIndex('applicable_type_value');
  28. }
  29. $table = $schema->getTable('external_config');
  30. if ($table->hasIndex('config_mount')) {
  31. $table->dropIndex('config_mount');
  32. }
  33. $table = $schema->getTable('external_options');
  34. if ($table->hasIndex('option_mount')) {
  35. $table->dropIndex('option_mount');
  36. }
  37. return $schema;
  38. }
  39. }