Version011602Date20230613160650.php 963 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\OAuth2\Migration;
  8. use Closure;
  9. use OCP\DB\ISchemaWrapper;
  10. use OCP\Migration\IOutput;
  11. use OCP\Migration\SimpleMigrationStep;
  12. class Version011602Date20230613160650 extends SimpleMigrationStep {
  13. public function __construct(
  14. ) {
  15. }
  16. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
  17. /** @var ISchemaWrapper $schema */
  18. $schema = $schemaClosure();
  19. if ($schema->hasTable('oauth2_clients')) {
  20. $table = $schema->getTable('oauth2_clients');
  21. if ($table->hasColumn('secret')) {
  22. $column = $table->getColumn('secret');
  23. // we still change the column length in case Version011601Date20230522143227
  24. // has run before it was changed to set the length to 512
  25. $column->setLength(512);
  26. return $schema;
  27. }
  28. }
  29. return null;
  30. }
  31. }