From 2552f5179baca030529d06c4a10d1f080ab3553f Mon Sep 17 00:00:00 2001 From: BroodjeAap Date: Mon, 3 Oct 2022 20:26:51 +0000 Subject: [PATCH] properly delete relations when deleting watch --- main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/main.go b/main.go index 548c0bd..55dbec1 100644 --- a/main.go +++ b/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, "/") }