Skip to content

Commit

Permalink
fix: db init table record
Browse files Browse the repository at this point in the history
  • Loading branch information
langhuihui committed Dec 13, 2024
1 parent af8ab60 commit 4a66d54
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions plugin/mp4/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ func (p *MP4Plugin) List(ctx context.Context, req *pb.ReqRecordList) (resp *pb.R
var totalCount int64 //总条数

// 查询总记录数
countQuery := p.DB.Model(m7s.RecordStream{})
countQuery := p.DB.Model(&m7s.RecordStream{})
// 查询当前页的数据
query := p.DB.Model(m7s.RecordStream{})
query := p.DB.Model(&m7s.RecordStream{})
if req.PageSize > 0 {
query = query.Limit(int(req.PageSize)).Offset(int(offset))
}
Expand Down
1 change: 1 addition & 0 deletions plugin/mp4/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ func (p *MP4Plugin) RegisterHandler() map[string]http.HandlerFunc {
func (p *MP4Plugin) OnInit() (err error) {
if p.DB != nil {
err = p.DB.AutoMigrate(&Exception{})
p.DB.AutoMigrate(&m7s.RecordStream{})
var deleteRecordTask DeleteRecordTask
deleteRecordTask.DB = p.DB
deleteRecordTask.DiskMaxPercent = p.DiskMaxPercent
Expand Down

0 comments on commit 4a66d54

Please sign in to comment.