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