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

fix: soft delete for join #5132

Closed
wants to merge 3 commits into from
Closed

Conversation

a631807682
Copy link
Member

  • Do only one thing
  • Non breaking API changes
  • Tested

What did this pull request do?

Soft delete should work for Joins.ON.Exprs.
close #4918

soft_delete.go Outdated
@@ -82,6 +82,24 @@ func (sd SoftDeleteQueryClause) ModifyStatement(stmt *Statement) {
}})
stmt.Clauses["soft_delete_enabled"] = clause.Clause{}
}

// Modify for Joins[i].ON exprs
if _, ok := stmt.Clauses["soft_delete_join_enabled"]; !ok && !stmt.Statement.Unscoped {
Copy link
Member Author

@a631807682 a631807682 Mar 7, 2022

Choose a reason for hiding this comment

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

It doesn't seem like a good way to update an join exprs here, but it fits the function name and doesn't break the changes.
Or should we create a new interface for custom QueryClauses to genegate exprs that need to be added, and then append in BuildQuerySQL

jinzhu pushed a commit that referenced this pull request Mar 17, 2022
commit a83023bdfc0dc6eaccc6704b64ff6436c2fe7725
Author: Jinzhu <wosmvp@gmail.com>
Date:   Fri Mar 18 01:05:25 2022 +0800

    Refactor #5132

commit 8559f51
Author: chenrui <chenrui@jingdaka.com>
Date:   Mon Mar 7 20:33:12 2022 +0800

    fix: should add deleted_at exprs for every joins

commit 2b7a1bd
Author: chenrui <chenrui@jingdaka.com>
Date:   Mon Mar 7 14:46:48 2022 +0800

    test: move debug flag

commit ce13a2a
Author: chenrui <chenrui@jingdaka.com>
Date:   Mon Mar 7 14:39:56 2022 +0800

    fix: soft delete for join.on
@jinzhu jinzhu closed this in c2e36eb Mar 17, 2022
@jinzhu
Copy link
Member

jinzhu commented Mar 17, 2022

Thank you for your PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Joins() doesn't respect soft deletes
2 participants