Skip to content

Commit 0a905dd

Browse files
committed
fix(mysql): Add migration to convert documents to lowercase
1 parent 548c8be commit 0a905dd

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2025 Jan-Philipp Litza
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCA\FullTextSearch_SQL\Migration;
11+
12+
use OCP\IConfig;
13+
use OCP\IDBConnection;
14+
use OCP\DB\Types;
15+
use OCP\Migration\IOutput;
16+
use OCP\Migration\SimpleMigrationStep;
17+
18+
class Version10000Date20251228000000 extends SimpleMigrationStep {
19+
public const TABLE = 'fts_documents';
20+
21+
public function __construct(
22+
private IDBConnection $db,
23+
) {
24+
}
25+
26+
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) {
27+
if ($this->db->getDatabaseProvider() != IDBConnection::PLATTFORM_MYSQL) {
28+
return;
29+
}
30+
31+
$query = $this->db->getQueryBuilder();
32+
$query->update(self::TABLE)
33+
->set('content', $query->func()->lower('content'));
34+
$query->executeStatement();
35+
}
36+
}

0 commit comments

Comments
 (0)