fix: scaffolder total query
fixes scaffolder list error with postgres: error: select count("tasks"."id")
as "count" from "tasks" order by "created_at" desc - column
"tasks.created_at" must appear in the GROUP BY clause or be used
in an aggregate function
Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder-backend': patch
|
||||
---
|
||||
|
||||
Fix tasks listing with postgres
|
||||
@@ -213,6 +213,9 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
queryBuilder.whereIn('status', [...new Set(arr)]);
|
||||
}
|
||||
|
||||
const countQuery = queryBuilder.clone();
|
||||
countQuery.count('tasks.id', { as: 'count' });
|
||||
|
||||
if (order) {
|
||||
order.forEach(f => {
|
||||
queryBuilder.orderBy(f.field, f.order);
|
||||
@@ -221,9 +224,6 @@ export class DatabaseTaskStore implements TaskStore {
|
||||
queryBuilder.orderBy('created_at', 'desc');
|
||||
}
|
||||
|
||||
const countQuery = queryBuilder.clone();
|
||||
countQuery.count('tasks.id', { as: 'count' });
|
||||
|
||||
if (pagination?.limit !== undefined) {
|
||||
queryBuilder.limit(pagination.limit);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user