-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
IUserConfig #47658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IUserConfig #47658
Changes from all commits
65e24f7
e73513b
7c04818
6afc855
5b4f190
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| <?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\DropIndex; | ||
| 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')] | ||
| #[AddColumn(table: 'preferences', name: 'flag', type: ColumnType::INTEGER, description: 'bitflag about the value')] | ||
| #[AddColumn(table: 'preferences', name: 'indexed', type: ColumnType::INTEGER, description: 'non-array value can be set as indexed')] | ||
| #[DropIndex(table: 'preferences', type: IndexType::INDEX, description: 'remove previous app/key index', notes: ['will be re-created to include \'indexed\' field'])] | ||
| #[AddIndex(table: 'preferences', type: IndexType::INDEX, description: 'new index including user+lazy')] | ||
| #[AddIndex(table: 'preferences', type: IndexType::INDEX, description: 'new index including app/key and indexed')] | ||
| 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]); | ||
ArtificialOwl marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| $table->addColumn('type', Types::SMALLINT, ['notnull' => true, 'default' => 0, 'unsigned' => true]); | ||
| $table->addColumn('flags', Types::INTEGER, ['notnull' => true, 'default' => 0, 'unsigned' => true]); | ||
| $table->addColumn('indexed', Types::STRING, ['notnull' => false, 'default' => '', 'length' => 64]); | ||
|
|
||
| // removing this index from Version13000Date20170718121200 | ||
| // $table->addIndex(['appid', 'configkey'], 'preferences_app_key'); | ||
| if ($table->hasIndex('preferences_app_key')) { | ||
| $table->dropIndex('preferences_app_key'); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for my dev instance running mariadb this DROP did not happen, so I now have redundant indexes: The migration code seems correct, but something seems to prevent the DROP. @ArtificialOwl could you check the upgrade path?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See #49638 The index is dropped... But next repair step run adds it again |
||
| } | ||
|
|
||
| $table->addIndex(['userid', 'lazy'], 'prefs_uid_lazy_i'); | ||
| $table->addIndex(['appid', 'configkey', 'indexed', 'flags'], 'prefs_app_key_ind_fl_i'); | ||
|
|
||
| return $schema; | ||
| } | ||
| } | ||

Uh oh!
There was an error while loading. Please reload this page.