diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e42b35c..f9ab9a29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/client/orm/db.go b/client/orm/db.go index 48987ab8..5a9f1b58 100644 --- a/client/orm/db.go +++ b/client/orm/db.go @@ -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 diff --git a/client/orm/orm_test.go b/client/orm/orm_test.go index f7805572..05f16a34 100644 --- a/client/orm/orm_test.go +++ b/client/orm/orm_test.go @@ -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) {