fix: allow global update when clear action logs

pull/204/head
jakezhu9 2 years ago committed by 1379Monitor
parent 11bd6e7a48
commit f28d49e55e

@ -2,6 +2,7 @@ package impl
import ( import (
"context" "context"
"gorm.io/gorm"
"github.com/go-sonic/sonic/dal" "github.com/go-sonic/sonic/dal"
"github.com/go-sonic/sonic/model/dto" "github.com/go-sonic/sonic/model/dto"
@ -18,7 +19,7 @@ func NewLogService() service.LogService {
func (l *logServiceImpl) Clear(ctx context.Context) error { func (l *logServiceImpl) Clear(ctx context.Context) error {
logDAL := dal.GetQueryByCtx(ctx).Log logDAL := dal.GetQueryByCtx(ctx).Log
_, err := logDAL.WithContext(ctx).Delete() _, err := logDAL.WithContext(ctx).Session(&gorm.Session{AllowGlobalUpdate: true}).Delete()
if err != nil { if err != nil {
return WrapDBErr(err) return WrapDBErr(err)
} }

Loading…
Cancel
Save