Merge pull request #4742 from flycash/fix4728
Fix 4741: Delete set id to 0
This commit is contained in:
commit
3f693d735d
@ -58,9 +58,8 @@
|
||||
- Refactor: Move `BindXXX` and `XXXResp` methods to `context.Context`. [4718](https://github.com/beego/beego/pull/4718)
|
||||
- Fix 4728: Print wrong file name. [4737](https://github.com/beego/beego/pull/4737)
|
||||
- fix bug:reflect.ValueOf(nil) in getFlatParams [4715](https://github.com/beego/beego/pull/4715)
|
||||
- Fix 4736: set a fixed value "/" to the "Path" of "_xsrf" cookie. [4736](https://github.com/beego/beego/issues/4735)
|
||||
- Fix 4734: do not reset id in Delete function. [4738](https://github.com/beego/beego/pull/4738)
|
||||
- Fix 4739: set a default value "/" for "Path" in the Cookie function when there is not parameter "Path" or the parameter is "". [4739](https://github.com/beego/beego/issues/4739)
|
||||
- Fix 4736: set a fixed value "/" to the "Path" of "_xsrf" cookie. [4736](https://github.com/beego/beego/issues/4735) [4739](https://github.com/beego/beego/issues/4739)
|
||||
- Fix 4734: do not reset id in Delete function. [4738](https://github.com/beego/beego/pull/4738) [4742](https://github.com/beego/beego/pull/4742)
|
||||
|
||||
## Fix Sonar
|
||||
|
||||
|
||||
@ -715,13 +715,6 @@ func (d *dbBase) Delete(ctx context.Context, q dbQuerier, mi *modelInfo, ind ref
|
||||
return 0, err
|
||||
}
|
||||
if num > 0 {
|
||||
if mi.fields.pk.auto {
|
||||
if mi.fields.pk.fieldType&IsPositiveIntegerField > 0 {
|
||||
ind.FieldByIndex(mi.fields.pk.fieldIndex).SetUint(0)
|
||||
} else {
|
||||
ind.FieldByIndex(mi.fields.pk.fieldIndex).SetInt(0)
|
||||
}
|
||||
}
|
||||
err := d.deleteRels(ctx, q, mi, args, tz)
|
||||
if err != nil {
|
||||
return num, err
|
||||
|
||||
@ -2403,8 +2403,10 @@ func TestReadOrCreate(t *testing.T) {
|
||||
throwFail(t, AssertIs(nu.Status, u.Status))
|
||||
throwFail(t, AssertIs(nu.IsStaff, u.IsStaff))
|
||||
throwFail(t, AssertIs(nu.IsActive, u.IsActive))
|
||||
assert.True(t, u.ID > 0)
|
||||
|
||||
dORM.Delete(u)
|
||||
assert.True(t, u.ID > 0)
|
||||
}
|
||||
|
||||
func TestInLine(t *testing.T) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user