Version29000Date20231126110901.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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 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. * Create new fields for type and lazy loading in appconfig for the new IAppConfig API.
  15. */
  16. class Version29000Date20231126110901 extends SimpleMigrationStep {
  17. public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper {
  18. /** @var ISchemaWrapper $schema */
  19. $schema = $schemaClosure();
  20. $table = $schema->getTable('appconfig');
  21. if ($table->hasColumn('lazy')) {
  22. return null;
  23. }
  24. /**
  25. * This code is now useless, after a discussion about boolean on oracle;
  26. * it has been decided to use another type for the lazy field
  27. *
  28. * a better migration process is available there:
  29. *
  30. * @see Version29000Date20240124132201 for the revert of current migration
  31. * @see Version29000Date20240124132202 for the new migration process
  32. */
  33. return null;
  34. // // type=2 means value is typed as MIXED
  35. // $table->addColumn('type', Types::INTEGER, ['notnull' => true, 'default' => 2]);
  36. // $table->addColumn('lazy', Types::BOOLEAN, ['notnull' => false, 'default' => false]);
  37. //
  38. // if ($table->hasIndex('appconfig_config_key_index')) {
  39. // $table->dropIndex('appconfig_config_key_index');
  40. // }
  41. //
  42. // $table->addIndex(['lazy'], 'ac_lazy_i');
  43. // $table->addIndex(['appid', 'lazy'], 'ac_app_lazy_i');
  44. // $table->addIndex(['appid', 'lazy', 'configkey'], 'ac_app_lazy_key_i');
  45. //
  46. // return $schema;
  47. }
  48. }