Skip to content

Commit

Permalink
Merge pull request #866 from actiontech/main
Browse files Browse the repository at this point in the history
Main
  • Loading branch information
hasa1K authored Jul 27, 2023
2 parents 1651101 + 5f71c83 commit d6ade44
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sqle/model/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -596,3 +596,22 @@ func (s *Storage) GetAllRulesByTmpNameAndProjectIdInstanceDBType(ruleTemplateNam
}
return rules, customRules, nil
}

func (s *Storage) DeleteCustomRule(ruleId string) error {
err := s.Tx(func(tx *gorm.DB) error {
if err := tx.Where("rule_id = ?", ruleId).Delete(&CustomRule{}).Error; err != nil {
return err
}
if err := tx.Where("rule_id = ?", ruleId).Delete(&RuleTemplateCustomRule{}).Error; err != nil {
return err
}

return nil
})

if err != nil {
return errors.ConnectStorageErrWrapper(err)
}

return nil
}

0 comments on commit d6ade44

Please sign in to comment.