srijeet0406 commented on code in PR #7224:
URL: https://github.com/apache/trafficcontrol/pull/7224#discussion_r1041501933
##########
traffic_ops/traffic_ops_golang/dbhelpers/db_helpers.go:
##########
@@ -850,13 +850,11 @@ func GetRequiredCapabilitiesOfDeliveryServices(ids []int,
tx *sql.Tx) (map[int][
dsCaps := make(map[int][]string, len(ids))
q := `
SELECT
- d.id,
- ARRAY_REMOVE(ARRAY_AGG(dsrc.required_capability ORDER BY
dsrc.required_capability), NULL) AS required_capabilities
-FROM deliveryservice d
-LEFT JOIN deliveryservices_required_capability dsrc on d.id =
dsrc.deliveryservice_id
-WHERE
- d.id = ANY($1)
-GROUP BY d.id
+ ds.id,
+ ARRAY_REMOVE((ds.required_capabilities), NULL) AS required_capabilities
Review Comment:
Yeah I just wanted to reduce the need for extra queries, and handle
everything in the DS table. I have made the changes to modify the "null" values
to "[]". Lmk if I've missed anything.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]