diff options
| author | Greg Roach <greg@subaqua.co.uk> | 2025-06-03 14:43:47 +0100 |
|---|---|---|
| committer | Greg Roach <greg@subaqua.co.uk> | 2025-06-03 14:43:47 +0100 |
| commit | 4edeb1151d9f485e117ce8024195fdb05d38c9a2 (patch) | |
| tree | 9ed75bea42eb06ae046da81c81d7a1bcba5306c6 | |
| parent | 85077687541941260bc4696c678259aa583d91ba (diff) | |
| download | webtrees-4edeb1151d9f485e117ce8024195fdb05d38c9a2.tar.gz webtrees-4edeb1151d9f485e117ce8024195fdb05d38c9a2.tar.bz2 webtrees-4edeb1151d9f485e117ce8024195fdb05d38c9a2.zip | |
Fix: Postgres driver requires alias for aggregate columns
| -rw-r--r-- | app/Http/RequestHandlers/ControlPanel.php | 16 | ||||
| -rw-r--r-- | resources/views/lists/locations-table.phtml | 4 | ||||
| -rw-r--r-- | resources/views/lists/media-table.phtml | 6 | ||||
| -rw-r--r-- | resources/views/lists/notes-table.phtml | 8 | ||||
| -rw-r--r-- | resources/views/lists/repositories-table.phtml | 2 | ||||
| -rw-r--r-- | resources/views/lists/sources-table.phtml | 8 | ||||
| -rw-r--r-- | resources/views/lists/submitters-table.phtml | 4 |
7 files changed, 24 insertions, 24 deletions
diff --git a/app/Http/RequestHandlers/ControlPanel.php b/app/Http/RequestHandlers/ControlPanel.php index 570b58d60f..d2236613a3 100644 --- a/app/Http/RequestHandlers/ControlPanel.php +++ b/app/Http/RequestHandlers/ControlPanel.php @@ -232,7 +232,7 @@ class ControlPanel implements RequestHandlerInterface ->where('change.status', '=', 'pending'); }) ->groupBy(['gedcom.gedcom_id']) - ->pluck(new Expression('COUNT(change_id)'), 'gedcom.gedcom_id') + ->pluck(new Expression('COUNT(change_id) AS total'), 'gedcom.gedcom_id') ->map(static fn (string $count): int => (int) $count) ->all(); } @@ -247,7 +247,7 @@ class ControlPanel implements RequestHandlerInterface return DB::table('gedcom') ->leftJoin('individuals', 'i_file', '=', 'gedcom_id') ->groupBy(['gedcom_id']) - ->pluck(new Expression('COUNT(i_id)'), 'gedcom_id') + ->pluck(new Expression('COUNT(i_id) AS total'), 'gedcom_id') ->map(static fn (string $count): int => (int) $count); } @@ -261,7 +261,7 @@ class ControlPanel implements RequestHandlerInterface return DB::table('gedcom') ->leftJoin('families', 'f_file', '=', 'gedcom_id') ->groupBy(['gedcom_id']) - ->pluck(new Expression('COUNT(f_id)'), 'gedcom_id') + ->pluck(new Expression('COUNT(f_id) AS total'), 'gedcom_id') ->map(static fn (string $count): int => (int) $count); } @@ -275,7 +275,7 @@ class ControlPanel implements RequestHandlerInterface return DB::table('gedcom') ->leftJoin('sources', 's_file', '=', 'gedcom_id') ->groupBy(['gedcom_id']) - ->pluck(new Expression('COUNT(s_id)'), 'gedcom_id') + ->pluck(new Expression('COUNT(s_id) AS total'), 'gedcom_id') ->map(static fn (string $count): int => (int) $count); } @@ -289,7 +289,7 @@ class ControlPanel implements RequestHandlerInterface return DB::table('gedcom') ->leftJoin('media', 'm_file', '=', 'gedcom_id') ->groupBy(['gedcom_id']) - ->pluck(new Expression('COUNT(m_id)'), 'gedcom_id') + ->pluck(new Expression('COUNT(m_id) AS total'), 'gedcom_id') ->map(static fn (string $count): int => (int) $count); } @@ -307,7 +307,7 @@ class ControlPanel implements RequestHandlerInterface ->where('o_type', '=', Repository::RECORD_TYPE); }) ->groupBy(['gedcom_id']) - ->pluck(new Expression('COUNT(o_id)'), 'gedcom_id') + ->pluck(new Expression('COUNT(o_id) AS total'), 'gedcom_id') ->map(static fn (string $count): int => (int) $count); } @@ -325,7 +325,7 @@ class ControlPanel implements RequestHandlerInterface ->where('o_type', '=', Note::RECORD_TYPE); }) ->groupBy(['gedcom_id']) - ->pluck(new Expression('COUNT(o_id)'), 'gedcom_id') + ->pluck(new Expression('COUNT(o_id) AS total'), 'gedcom_id') ->map(static fn (string $count): int => (int) $count); } @@ -343,7 +343,7 @@ class ControlPanel implements RequestHandlerInterface ->where('o_type', '=', Submitter::RECORD_TYPE); }) ->groupBy(['gedcom_id']) - ->pluck(new Expression('COUNT(o_id)'), 'gedcom_id') + ->pluck(new Expression('COUNT(o_id) AS total'), 'gedcom_id') ->map(static fn (string $count): int => (int) $count); } } diff --git a/resources/views/lists/locations-table.phtml b/resources/views/lists/locations-table.phtml index 5133aab440..0910885db4 100644 --- a/resources/views/lists/locations-table.phtml +++ b/resources/views/lists/locations-table.phtml @@ -30,7 +30,7 @@ $count_individuals = DB::table('individuals') ->where('l_type', '=', '_LOC') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); @@ -42,7 +42,7 @@ $count_families = DB::table('families') ->where('l_type', '=', '_LOC') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); ?> diff --git a/resources/views/lists/media-table.phtml b/resources/views/lists/media-table.phtml index cb04880d90..fc76753e64 100644 --- a/resources/views/lists/media-table.phtml +++ b/resources/views/lists/media-table.phtml @@ -30,7 +30,7 @@ $count_individuals = DB::table('individuals') ->where('l_type', '=', 'OBJE') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); @@ -42,7 +42,7 @@ $count_families = DB::table('families') ->where('l_type', '=', 'OBJE') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); @@ -54,7 +54,7 @@ $count_sources = DB::table('sources') ->where('l_type', '=', 'OBJE') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); ?> diff --git a/resources/views/lists/notes-table.phtml b/resources/views/lists/notes-table.phtml index 1536820674..1b01909083 100644 --- a/resources/views/lists/notes-table.phtml +++ b/resources/views/lists/notes-table.phtml @@ -30,7 +30,7 @@ $count_individuals = DB::table('individuals') ->where('l_type', '=', 'NOTE') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); @@ -42,7 +42,7 @@ $count_families = DB::table('families') ->where('l_type', '=', 'NOTE') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); @@ -54,7 +54,7 @@ $count_media = DB::table('media') ->where('l_type', '=', 'NOTE') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); @@ -66,7 +66,7 @@ $count_sources = DB::table('sources') ->where('l_type', '=', 'NOTE') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); ?> diff --git a/resources/views/lists/repositories-table.phtml b/resources/views/lists/repositories-table.phtml index 0e4350a07b..71c82dbb2e 100644 --- a/resources/views/lists/repositories-table.phtml +++ b/resources/views/lists/repositories-table.phtml @@ -30,7 +30,7 @@ $count_sources = DB::table('sources') ->where('l_type', '=', 'REPO') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); ?> diff --git a/resources/views/lists/sources-table.phtml b/resources/views/lists/sources-table.phtml index fdbc8d836f..5fad504224 100644 --- a/resources/views/lists/sources-table.phtml +++ b/resources/views/lists/sources-table.phtml @@ -31,7 +31,7 @@ $count_individuals = DB::table('individuals') ->where('l_type', '=', 'SOUR') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); @@ -43,7 +43,7 @@ $count_families = DB::table('families') ->where('l_type', '=', 'SOUR') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); @@ -55,7 +55,7 @@ $count_media = DB::table('media') ->where('l_type', '=', 'SOUR') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); @@ -68,7 +68,7 @@ $count_notes = DB::table('other') ->where('l_type', '=', 'SOUR') ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); ?> diff --git a/resources/views/lists/submitters-table.phtml b/resources/views/lists/submitters-table.phtml index 3a84b95d5c..a2d555d8f4 100644 --- a/resources/views/lists/submitters-table.phtml +++ b/resources/views/lists/submitters-table.phtml @@ -33,7 +33,7 @@ $count_individuals = DB::table('individuals') ->where('l_type', '=', Submitter::RECORD_TYPE) ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); @@ -45,7 +45,7 @@ $count_families = DB::table('families') ->where('l_type', '=', Submitter::RECORD_TYPE) ->where('l_file', '=', $tree->id()) ->groupBy(['l_to']) - ->pluck(new Expression('COUNT(*)'), 'l_to') + ->pluck(new Expression('COUNT(*) AS total'), 'l_to') ->map(static fn (string $n): int => (int) $n) ->all(); ?> |
