diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2024-10-03 12:52:26 -0100 |
---|---|---|
committer | Maxence Lange <maxence@artificial-owl.com> | 2024-11-18 20:11:31 -0100 |
commit | 65e24f7def517d33ccaac15946db882fe35d8175 (patch) | |
tree | 8f614704c627c0f124441a41706262d0697762b3 /core | |
parent | 4b769f661dba7032b9502ecaaf6a71cba5588dfa (diff) | |
download | nextcloud-server-65e24f7def517d33ccaac15946db882fe35d8175.tar.gz nextcloud-server-65e24f7def517d33ccaac15946db882fe35d8175.zip |
feat(user-prefs): IUserPreferences
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'core')
-rw-r--r-- | core/Migrations/Version31000Date20240814184402.php | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/core/Migrations/Version31000Date20240814184402.php b/core/Migrations/Version31000Date20240814184402.php new file mode 100644 index 00000000000..20804b1b19e --- /dev/null +++ b/core/Migrations/Version31000Date20240814184402.php @@ -0,0 +1,39 @@ +<?php + +declare(strict_types=1); +/** + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +namespace OC\Core\Migrations; + +use Closure; +use OCP\DB\ISchemaWrapper; +use OCP\DB\Types; +use OCP\Migration\Attributes\AddColumn; +use OCP\Migration\Attributes\AddIndex; +use OCP\Migration\Attributes\ColumnType; +use OCP\Migration\Attributes\IndexType; +use OCP\Migration\IOutput; +use OCP\Migration\SimpleMigrationStep; + +/** + * Create new column and index for lazy loading in preferences for the new IUserPreferences API. + */ +#[AddColumn(table: 'preferences', name: 'lazy', type: ColumnType::SMALLINT, description: 'lazy loading to user preferences')] +#[AddColumn(table: 'preferences', name: 'type', type: ColumnType::SMALLINT, description: 'typed values to user preferences')] +#[AddIndex(table: 'preferences', type: IndexType::INDEX, description: 'new index including lazy flag')] +class Version31000Date20240814184402 extends SimpleMigrationStep { + public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { + /** @var ISchemaWrapper $schema */ + $schema = $schemaClosure(); + + $table = $schema->getTable('preferences'); + $table->addColumn('lazy', Types::SMALLINT, ['notnull' => true, 'default' => 0, 'length' => 1, 'unsigned' => true]); + $table->addColumn('type', Types::INTEGER, ['notnull' => true, 'default' => 2, 'unsigned' => true]); + $table->addIndex(['userid', 'lazy'], 'prefs_uid_lazy_i'); + + return $schema; + } +} |