From 774bb066d97189a719f64c0d51eeffd187613fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=B4me=20Chilliet?= Date: Thu, 24 Mar 2022 11:12:12 +0100 Subject: [PATCH] Use getLengthExpression to measure field length instead of like MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Côme Chilliet --- apps/user_ldap/lib/Migration/Version1120Date20210917155206.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php b/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php index d2b440c4dfe..87a8f07fbe1 100644 --- a/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php +++ b/apps/user_ldap/lib/Migration/Version1120Date20210917155206.php @@ -127,9 +127,10 @@ class Version1120Date20210917155206 extends SimpleMigrationStep { protected function getSelectQuery(string $table): IQueryBuilder { $qb = $this->dbc->getQueryBuilder(); + $lengthExpr = $this->dbc->getDatabasePlatform()->getLengthExpression('owncloud_name'); $qb->select('owncloud_name', 'directory_uuid') ->from($table) - ->where($qb->expr()->like('owncloud_name', $qb->createNamedParameter(str_repeat('_', 65) . '%'), Types::STRING)); + ->where($qb->expr()->gt($qb->createFunction($lengthExpr), '64', IQueryBuilder::PARAM_INT)); return $qb; }