-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
many2many Update更新重复创建 #5579
Comments
生成的sql竟然是操作user的这个表 |
当前版本使用的是gorm.io/gorm v1.23.8 |
@jinzhu 能看下这个问题吗?我发现这个确实是个bug |
中间表会不停的创建 |
If you think there is a bug, please create a PR to describe it in the playground. |
This issue has been automatically marked as stale because it has been open 360 days with no activity. Remove stale label or comment or this will be closed in 180 days |
GORM Playground Link
go-gorm/playground#1
Description
type CmeQuestion struct {
Id int
gorm:"primary_key" json:"id"
QuestionTitle string
json:"question_title"
AnalysisContent string
json:"analysis_content"
Link string
json:"link"
BindCount int
json:"bind_count"
Deleted soft_delete.DeletedAt
json:"deleted" gorm:"softDelete:flag"
Tag []CmeQuestionTag
json:"tag" gorm:"many2many:question_tag;"
Selection []CmeQuestionSelection
json:"selection" gorm:"foreignkey:CmeQuestionId"
CreateTime time.Time
json:"create_time,omitempty" gorm:"autoCreateTime:true"
UpdateTime time.Time
json:"update_time,omitempty" gorm:"autoUpdateTime:true"
DeleteTime gorm.DeletedAt
json:"delete_time"
}
dao.Db.Session(&gorm.Session{FullSaveAssociations: true}).Updates(&dao.UpdateModel).Error
The text was updated successfully, but these errors were encountered: