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; }