1
0

Version29000Date20240124132202.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536
  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 column and index for lazy loading in appconfig for the new IAppConfig API.
  15. */
  16. class Version29000Date20240124132202 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. $table->addColumn('lazy', Types::SMALLINT, ['notnull' => true, 'default' => 0, 'length' => 1, 'unsigned' => true]);
  22. /**
  23. * we only need an index on lazy, the group 'appid'+'configkey' already
  24. * exists as primary ({@see Version13000Date20170718121200})
  25. */
  26. $table->addIndex(['lazy'], 'ac_lazy_i');
  27. return $schema;
  28. }
  29. }