don't reuse modifier, use table name instead

This commit is contained in:
mtsoltan 2024-08-12 04:06:06 +03:00
parent a1d9d7dc18
commit c380166ff5
No known key found for this signature in database
GPG Key ID: 2F56E59CE4D1D296
2 changed files with 7 additions and 2 deletions

View File

@ -132,7 +132,7 @@ func Delete(config *Config) func(db *gorm.DB) {
HandleJoins(
db,
func(db *gorm.DB) {
deleteClause.Modifier = db.Statement.Table
deleteClause.Table = db.Statement.Table
},
func(db *gorm.DB, tableAliasName string, idx int, relation *schema.Relationship) {
},

View File

@ -2,6 +2,7 @@ package clause
type Delete struct {
Modifier string
Table string
}
func (d Delete) Name() string {
@ -13,7 +14,11 @@ func (d Delete) Build(builder Builder) {
if d.Modifier != "" {
builder.WriteByte(' ')
builder.WriteQuoted(d.Modifier)
builder.WriteString(d.Modifier)
}
if d.Table != "" {
builder.WriteByte(' ')
builder.WriteQuoted(d.Table)
}
}