[MM-46097] Change FileInfo count query (#20871)
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -2213,14 +2213,13 @@ func (s SqlChannelStore) GetFileCount(channelId string) (int64, error) {
|
|||||||
var count int64
|
var count int64
|
||||||
err := s.GetReplicaX().Get(&count, `
|
err := s.GetReplicaX().Get(&count, `
|
||||||
SELECT
|
SELECT
|
||||||
COUNT(*)
|
COUNT(*)
|
||||||
FROM
|
FROM
|
||||||
FileInfo
|
FileInfo
|
||||||
LEFT JOIN Posts as P ON FileInfo.PostId=P.Id
|
|
||||||
LEFT JOIN Channels as C on C.Id=P.ChannelId
|
|
||||||
WHERE
|
WHERE
|
||||||
FileInfo.DeleteAt = 0
|
FileInfo.DeleteAt = 0
|
||||||
AND C.Id = ?`, channelId)
|
AND FileInfo.PostId IN (SELECT id FROM Posts WHERE ChannelId = ?)`,
|
||||||
|
channelId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, errors.Wrapf(err, "failed to count files with channelId=%s", channelId)
|
return 0, errors.Wrapf(err, "failed to count files with channelId=%s", channelId)
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user