properly delete relations when deleting watch
This commit is contained in:
parent
35e93bbe59
commit
2552f5179b
1 changed files with 4 additions and 0 deletions
4
main.go
4
main.go
|
@ -57,6 +57,10 @@ func (web Web) deleteWatch(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
web.db.Delete(&FilterConnection{}, "watch_id = ?", id)
|
||||
web.db.Delete(&FilterOutput{}, "watch_id = ?", id)
|
||||
web.db.Delete(&Filter{}, "watch_id = ?", id)
|
||||
|
||||
web.db.Delete(&Watch{}, id)
|
||||
c.Redirect(http.StatusSeeOther, "/")
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue