Version24000Date20220202150027.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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\DB\Types;
  11. use OCP\Migration\IOutput;
  12. use OCP\Migration\SimpleMigrationStep;
  13. /**
  14. * Auto-generated migration step: Please modify to your needs!
  15. */
  16. class Version24000Date20220202150027 extends SimpleMigrationStep {
  17. /**
  18. * @param IOutput $output
  19. * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
  20. * @param array $options
  21. * @return null|ISchemaWrapper
  22. */
  23. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  24. /** @var ISchemaWrapper $schema */
  25. $schema = $schemaClosure();
  26. $table = $schema->getTable('mounts');
  27. if (!$table->hasColumn('mount_provider_class')) {
  28. $table->addColumn('mount_provider_class', Types::STRING, [
  29. 'notnull' => false,
  30. 'length' => 128,
  31. ]);
  32. $table->addIndex(['mount_provider_class'], 'mounts_class_index');
  33. return $schema;
  34. }
  35. return null;
  36. }
  37. }