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

Delete() 在删除关联的Associate 时候的sql 执行顺序是不固定的? #7264

Open
jaxsong opened this issue Nov 5, 2024 · 1 comment
Assignees
Labels
type:question general questions

Comments

@jaxsong
Copy link

jaxsong commented Nov 5, 2024

Your Question

多个嵌入的结构中,如果通过 clause.Associations 删除该model下全部的关联关系(包含一个 hasmany 和 一个many2many )
db.Select(clause.Associations).Delete(&TargetModel{}) 语句执行的删除sql 执行顺序不一致? 这个是预期的吗?
这会导致在使用sqlmock 这类工具的时候,偶发性的出现测试因为顺序问题不能通过。

The document you expected this should be explained

Expected answer

@jaxsong jaxsong added the type:question general questions label Nov 5, 2024
@alex-guoba
Copy link

看代码好像是, Relationships.Relations 存储的是map。
使用 * 或者 指定字段试试

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

No branches or pull requests

3 participants