From 32c209d8a83ed5a3f7c1a08a6cabafdad4cfef9c Mon Sep 17 00:00:00 2001 From: Maxence Lange Date: Mon, 2 Sep 2024 12:17:05 -0100 Subject: [PATCH] fix test Signed-off-by: Maxence Lange --- core/Migrations/Version31000Date20240814184402.php | 2 -- lib/private/UserPreferences.php | 7 ++++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/core/Migrations/Version31000Date20240814184402.php b/core/Migrations/Version31000Date20240814184402.php index b394119eee002..20804b1b19efe 100644 --- a/core/Migrations/Version31000Date20240814184402.php +++ b/core/Migrations/Version31000Date20240814184402.php @@ -24,7 +24,6 @@ #[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')] -#[AddIndex(table: 'preferences', type: IndexType::INDEX, description: 'new index including config value to improve searchUsersByValue')] class Version31000Date20240814184402 extends SimpleMigrationStep { public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ @@ -34,7 +33,6 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt $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'); - $table->addIndex(['appid', 'configkey', 'configvalue'], 'prefs_app_key_value_i'); return $schema; } diff --git a/lib/private/UserPreferences.php b/lib/private/UserPreferences.php index d3f30537f7236..7c53fd640d8ed 100644 --- a/lib/private/UserPreferences.php +++ b/lib/private/UserPreferences.php @@ -386,16 +386,17 @@ public function searchUsersByValueString(string $app, string $key, string|array $qb->where($qb->expr()->eq('appid', $qb->createNamedParameter($app))); $qb->andWhere($qb->expr()->eq('configkey', $qb->createNamedParameter($key))); + $configValueColumn = ($this->connection->getDatabaseProvider() === IDBConnection::PLATFORM_ORACLE) ? $qb->expr()->castColumn('configvalue', IQueryBuilder::PARAM_STR) : 'configvalue'; if (is_array($value)) { - $qb->andWhere($qb->expr()->in('configvalue', $qb->createNamedParameter($value, IQueryBuilder::PARAM_STR_ARRAY))); + $qb->andWhere($qb->expr()->in($configValueColumn, $qb->createNamedParameter($value, IQueryBuilder::PARAM_STR_ARRAY))); } else { if ($caseInsensitive) { $qb->andWhere($qb->expr()->eq( - $qb->func()->lower('configvalue'), + $qb->func()->lower($configValueColumn), $qb->createNamedParameter(strtolower($value))) ); } else { - $qb->andWhere($qb->expr()->eq('configvalue', $qb->createNamedParameter($value))); + $qb->andWhere($qb->expr()->eq($configValueColumn, $qb->createNamedParameter($value))); } }