️ improve: 删除服务时删除历史数据

This commit is contained in:
naiba 2021-01-16 15:05:35 +08:00
parent 7df63939d2
commit 4b6740e6e0

View File

@ -67,6 +67,9 @@ func (ma *memberAPI) delete(c *gin.Context) {
} }
case "monitor": case "monitor":
err = dao.DB.Delete(&model.Monitor{}, "id = ?", id).Error err = dao.DB.Delete(&model.Monitor{}, "id = ?", id).Error
if err == nil {
err = dao.DB.Delete(&model.MonitorHistory{}, "monitor_id = ?", id).Error
}
case "alert-rule": case "alert-rule":
err = dao.DB.Delete(&model.AlertRule{}, "id = ?", id).Error err = dao.DB.Delete(&model.AlertRule{}, "id = ?", id).Error
if err == nil { if err == nil {