Fix ordering on Postgres

This commit is contained in:
Alejandro Celaya 2023-02-12 13:35:05 +01:00
parent dd049feb40
commit 49b6063501

View File

@ -107,8 +107,8 @@ class TagRepository extends EntitySpecificationRepository implements TagReposito
->select( ->select(
't.id_0 AS id', 't.id_0 AS id',
't.name_1 AS name', 't.name_1 AS name',
'v.visits', 'COALESCE(v.visits, 0) AS visits', // COALESCE required for postgres to properly order
'v2.non_bot_visits', 'COALESCE(v2.non_bot_visits, 0) AS non_bot_visits', // COALESCE required for postgres to properly order
'COUNT(DISTINCT s.id) AS short_urls_count', 'COUNT(DISTINCT s.id) AS short_urls_count',
) )
->from('(' . $subQb->getQuery()->getSQL() . ')', 't') // @phpstan-ignore-line ->from('(' . $subQb->getQuery()->getSQL() . ')', 't') // @phpstan-ignore-line