Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicated sort fields from order by clause #19347

Merged
merged 1 commit into from Sep 16, 2023

Conversation

liubin
Copy link
Contributor

@liubin liubin commented Sep 12, 2023

Thank you for contributing to Harbor!

Comprehensive Summary of your change

Remove duplicated sort fields from order by clause
In MustClone() it will set Sorts field twice, that will generate two duplicated order by fields in the generated SQL.

For example, in the project list API, the SQL will be(formated):

[ORM]2023/09/12 19:26:16  -[Queries/default] - [  OK /    db.Query /     7.1ms] -
 [SELECT T0.`project_id`, T0.`owner_id`, T0.`name`,
 T0.`creation_time`, T0.`update_time`, T0.`deleted`, 
T0.`registry_id` 
FROM `project` T0 
WHERE T0.`deleted` = ? 
ORDER BY T0.`name` ASC, T0.`name` ASC 
LIMIT 50] - `false`

Issue being fixed

Fixes #(issue)

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

@liubin liubin requested a review from a team as a code owner September 12, 2023 11:33
@codecov
Copy link

codecov bot commented Sep 12, 2023

Codecov Report

Merging #19347 (2586707) into main (ed370a4) will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #19347      +/-   ##
==========================================
+ Coverage   67.45%   67.47%   +0.02%     
==========================================
  Files         988      988              
  Lines      108689   108688       -1     
  Branches     2752     2752              
==========================================
+ Hits        73312    73335      +23     
+ Misses      31435    31410      -25     
- Partials     3942     3943       +1     
Flag Coverage Δ
unittests 67.47% <ø> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/lib/q/query.go 72.91% <ø> (+11.69%) ⬆️

... and 8 files with indirect coverage changes

@chlins
Copy link
Member

chlins commented Sep 14, 2023

@liubin Thanks, it makes senses.

Copy link
Member

@chlins chlins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@chlins chlins added the release-note/update Update or Fix label Sep 14, 2023
In MustClone() it will set Sorts field twice, that will
generate two duplicated order by fields in the generated SQL.

Signed-off-by: bin liu <liubin0329@gmail.com>
@wy65701436 wy65701436 merged commit 26a4f6e into goharbor:main Sep 16, 2023
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/update Update or Fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants