Skip to content

Commit

Permalink
fix: 解决监控数据迁移失败的问题 (1Panel-dev#4569)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssongliu authored Apr 18, 2024
1 parent a5fdff6 commit bb02991
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions backend/init/migration/migrations/v_1_10.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ var NewMonitorDB = &gormigrate.Migration{
} else {
itemData = bases[200*i:]
}
if err := global.MonitorDB.Create(&itemData).Error; err != nil {
return err
if len(itemData) != 0 {
if err := global.MonitorDB.Create(&itemData).Error; err != nil {
return err
}
}
}
}
Expand All @@ -87,8 +89,10 @@ var NewMonitorDB = &gormigrate.Migration{
} else {
itemData = ios[200*i:]
}
if err := global.MonitorDB.Create(&itemData).Error; err != nil {
return err
if len(itemData) != 0 {
if err := global.MonitorDB.Create(&itemData).Error; err != nil {
return err
}
}
}
}
Expand All @@ -100,8 +104,10 @@ var NewMonitorDB = &gormigrate.Migration{
} else {
itemData = networks[200*i:]
}
if err := global.MonitorDB.Create(&itemData).Error; err != nil {
return err
if len(itemData) != 0 {
if err := global.MonitorDB.Create(&itemData).Error; err != nil {
return err
}
}
}
}
Expand Down

0 comments on commit bb02991

Please sign in to comment.