Revert "Replace COUNT(DISTINCT primary_key) with COUNT(*)"

Genres are required as part of the count queries, so filter by genres work
This commit is contained in:
Deluan
2023-11-25 23:08:20 -05:00
parent 8c8e1ea701
commit 28dc98dec4
4 changed files with 5 additions and 1 deletions
+2 -1
View File
@@ -181,7 +181,8 @@ func (r sqlRepository) exists(existsQuery SelectBuilder) (bool, error) {
func (r sqlRepository) count(countQuery SelectBuilder, options ...model.QueryOptions) (int64, error) {
countQuery = countQuery.
RemoveColumns().Columns("count(*) as count").From(r.tableName)
RemoveColumns().Columns("count(distinct " + r.tableName + ".id) as count").
From(r.tableName)
countQuery = r.applyFilters(countQuery, options...)
var res struct{ Count int64 }
err := r.queryOne(countQuery, &res)