mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-22 18:25:56 +01:00
[cherry-pick] Adjust the query by UUID sql so that it can use the idx_task_extra_at… (#20552)
Adjust the query by UUID sql so that it can use the idx_task_extra_attrs_report_uuids fixes #20505 Signed-off-by: stonezdj <stone.zhang@broadcom.com>
This commit is contained in:
parent
64e4c85273
commit
78012c9ac6
@ -122,10 +122,7 @@ var (
|
||||
{Resource: rbac.ResourceMember, Action: rbac.ActionRead},
|
||||
{Resource: rbac.ResourceMember, Action: rbac.ActionList},
|
||||
|
||||
{Resource: rbac.ResourceMetadata, Action: rbac.ActionCreate},
|
||||
{Resource: rbac.ResourceMetadata, Action: rbac.ActionRead},
|
||||
{Resource: rbac.ResourceMetadata, Action: rbac.ActionUpdate},
|
||||
{Resource: rbac.ResourceMetadata, Action: rbac.ActionDelete},
|
||||
|
||||
{Resource: rbac.ResourceLog, Action: rbac.ActionList},
|
||||
|
||||
|
@ -114,8 +114,8 @@ func (t *taskDAO) ListScanTasksByReportUUID(ctx context.Context, uuid string) ([
|
||||
}
|
||||
|
||||
var tasks []*Task
|
||||
param := fmt.Sprintf(`{"report_uuids":["%s"]}`, uuid)
|
||||
sql := `SELECT * FROM task WHERE extra_attrs::jsonb @> cast( ? as jsonb )`
|
||||
param := fmt.Sprintf(`"%s"`, uuid)
|
||||
sql := `SELECT * FROM task WHERE extra_attrs::jsonb -> 'report_uuids' @> ?`
|
||||
_, err = ormer.Raw(sql, param).QueryRows(&tasks)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
Loading…
Reference in New Issue
Block a user