From 84fe78825722bd0eb6582af3b5cb79fda7c4be05 Mon Sep 17 00:00:00 2001 From: bencroker Date: Mon, 19 Feb 2024 07:35:37 -0600 Subject: [PATCH] Fix missing columns in `groupBy` for Postgres --- CHANGELOG.md | 6 +++++- src/helpers/DiagnosticsHelper.php | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4fb1ec6e..c048a945 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,15 @@ # Release Notes for Blitz -## 4.11.2 - Unreleased +## 4.11.2 - 2024-02-19 ### Changed - Asset queries containing filenames are no longer tracked. +### Fixed + +- Fixed a bug in the diagnostics utility that only affected Postgres ([#621](https://github.com/putyourlightson/craft-blitz/issues/621)). + ## 4.11.1 - 2024-02-12 ### Fixed diff --git a/src/helpers/DiagnosticsHelper.php b/src/helpers/DiagnosticsHelper.php index c5da4e3e..e6a76c83 100644 --- a/src/helpers/DiagnosticsHelper.php +++ b/src/helpers/DiagnosticsHelper.php @@ -172,7 +172,7 @@ public static function getElementsQuery(int $siteId, string $elementType, ?int $ ->innerJoin(['elements' => Table::ELEMENTS], '[[elements.id]] = [[elementcaches.elementId]]') ->innerJoin(['content' => Table::CONTENT], '[[content.elementId]] = [[elementcaches.elementId]]') ->where($condition) - ->groupBy(['elementcaches.elementId', 'title']) + ->groupBy(['elementcaches.elementId', 'elementexpirydates.expiryDate', 'title']) ->asArray(); } @@ -192,7 +192,7 @@ public static function getElementQueriesQuery(int $siteId, string $elementType, ->innerJoinWith('cache') ->innerJoinWith('elementQuery') ->where($condition) - ->groupBy(ElementQueryRecord::tableName() . '.id') + ->groupBy([ElementQueryRecord::tableName() . '.id', 'params']) ->asArray(); }