Switch to ARRAY_AGG for database aggregations to improve peformance + fix gallery images not showing up (#242)

This commit is contained in:
Geometrically
2021-08-31 15:29:51 -07:00
committed by GitHub
parent f37e267a5e
commit efb82847cb
6 changed files with 923 additions and 923 deletions

View File

@@ -303,7 +303,7 @@ impl Loader {
let result = sqlx::query!(
"
SELECT l.id id, l.loader loader, l.icon icon,
STRING_AGG(DISTINCT pt.name, ',') project_types
ARRAY_AGG(DISTINCT pt.name) project_types
FROM loaders l
LEFT OUTER JOIN loaders_project_types lpt ON joining_loader_id = l.id
LEFT OUTER JOIN project_types pt ON lpt.joining_project_type_id = pt.id
@@ -319,7 +319,7 @@ impl Loader {
supported_project_types: x
.project_types
.unwrap_or_default()
.split(',')
.iter()
.map(|x| x.to_string())
.collect(),
}))