From dbe140ecaf9358f84fb370ba7b43120a5ac09da4 Mon Sep 17 00:00:00 2001 From: qowevisa Date: Wed, 20 Nov 2024 18:17:45 +0200 Subject: [PATCH] Set CASCADE delete for ItemPrice from Item deletion --- db/item.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/item.go b/db/item.go index 1d5da20..e2fff33 100644 --- a/db/item.go +++ b/db/item.go @@ -17,7 +17,7 @@ type Item struct { Carbs uint64 Fats uint64 // - Prices []ItemPrice + Prices []ItemPrice `gorm:"constraint:OnDelete:CASCADE;"` CurrentPriceID uint CurrentPrice *ItemPrice //