Merge pull request #19284 from nextcloud/backport/19281/stable17

[stable17] for the DB ot pick an index specify the object_type
This commit is contained in:
Roeland Jago Douma 2020-02-04 08:48:55 +01:00 committed by GitHub
commit 3678d00ae9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -600,11 +600,13 @@ class Manager implements ICommentsManager {
$query = $qb->select('f.fileid') $query = $qb->select('f.fileid')
->addSelect($qb->func()->count('c.id', 'num_ids')) ->addSelect($qb->func()->count('c.id', 'num_ids'))
->from('filecache', 'f') ->from('filecache', 'f')
->leftJoin('f', 'comments', 'c', $qb->expr()->eq( ->leftJoin('f', 'comments', 'c', $qb->expr()->andX(
'f.fileid', $qb->expr()->castColumn('c.object_id', IQueryBuilder::PARAM_INT) $qb->expr()->eq('f.fileid', $qb->expr()->castColumn('c.object_id', IQueryBuilder::PARAM_INT)),
$qb->expr()->eq('c.object_type', $qb->createNamedParameter('files'))
)) ))
->leftJoin('c', 'comments_read_markers', 'm', $qb->expr()->eq( ->leftJoin('c', 'comments_read_markers', 'm', $qb->expr()->andX(
'c.object_id', 'm.object_id' $qb->expr()->eq('c.object_id', 'm.object_id'),
$qb->expr()->eq('m.object_type', $qb->createNamedParameter('files'))
)) ))
->where( ->where(
$qb->expr()->andX( $qb->expr()->andX(