aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2024-10-17 08:48:09 -0100
committerMaxence Lange <maxence@artificial-owl.com>2024-11-18 20:11:31 -0100
commite73513bdd1f42da656b79bf78d8d3763386d26b1 (patch)
tree5d11c2d3c98d35aaf0d8bea32386f57f97d1b920 /core
parent65e24f7def517d33ccaac15946db882fe35d8175 (diff)
downloadnextcloud-server-e73513bdd1f42da656b79bf78d8d3763386d26b1.tar.gz
nextcloud-server-e73513bdd1f42da656b79bf78d8d3763386d26b1.zip
fix(user-prefs): adding sensitive and indexed as flags
Signed-off-by: Maxence Lange <maxence@artificial-owl.com>
Diffstat (limited to 'core')
-rw-r--r--core/Migrations/Version31000Date20240814184402.php19
1 files changed, 17 insertions, 2 deletions
diff --git a/core/Migrations/Version31000Date20240814184402.php b/core/Migrations/Version31000Date20240814184402.php
index 20804b1b19e..87b7e93db97 100644
--- a/core/Migrations/Version31000Date20240814184402.php
+++ b/core/Migrations/Version31000Date20240814184402.php
@@ -14,6 +14,7 @@ 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;
@@ -23,7 +24,11 @@ use OCP\Migration\SimpleMigrationStep;
*/
#[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')]
+#[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 */
@@ -31,8 +36,18 @@ class Version31000Date20240814184402 extends SimpleMigrationStep {
$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->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' => true, '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');
+ }
+
$table->addIndex(['userid', 'lazy'], 'prefs_uid_lazy_i');
+ $table->addIndex(['appid', 'configkey', 'indexed', 'flags'], 'prefs_app_key_ind_fl_i');
return $schema;
}