From b6feb2d65699781b9bebab63679270554b0c0315 Mon Sep 17 00:00:00 2001 From: Julien Riou Date: Fri, 14 May 2021 16:08:09 +0200 Subject: [PATCH] Auto-remove stale products (#30) Signed-off-by: Julien Riou --- notifier_telegram.go | 2 +- notifier_twitter.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/notifier_telegram.go b/notifier_telegram.go index 9cbe369..5dfbe84 100644 --- a/notifier_telegram.go +++ b/notifier_telegram.go @@ -14,7 +14,7 @@ type TelegramMessage struct { gorm.Model MessageID int `gorm:"not null;unique"` ProductURL string - Product Product `gorm:"not null;references:URL"` + Product Product `gorm:"not null;references:URL;constraint:OnDelete:CASCADE"` } // TelegramNotifier to manage notifications to Twitter diff --git a/notifier_twitter.go b/notifier_twitter.go index d71a4d3..2a81bef 100644 --- a/notifier_twitter.go +++ b/notifier_twitter.go @@ -25,7 +25,7 @@ type Tweet struct { LastTweetID int64 `gorm:"index"` Counter int64 `gorm:"not null;default:1"` ProductURL string `gorm:"index"` - Product Product `gorm:"not null;references:URL"` + Product Product `gorm:"not null;references:URL;constraint:OnDelete:CASCADE"` } // TwitterNotifier to manage notifications to Twitter