Просмотр исходного кода

add jsonb config to notification config schema: (#4243)

d-g-town 2 лет назад
Родитель
Сommit
cc48606aba
2 измененных файлов с 6 добавлено и 0 удалено
  1. 3 0
      internal/models/integrations/slack.go
  2. 3 0
      internal/models/notification.go

+ 3 - 0
internal/models/integrations/slack.go

@@ -44,6 +44,9 @@ type SlackIntegration struct {
 
 	// The webhook to call
 	Webhook []byte
+
+	// NotificationConfigID is the ID of the notification config to use
+	NotificationConfigID uint `gorm:"default:0"`
 }
 
 func (s *SlackIntegration) ToSlackIntegraionType() *types.SlackIntegration {

+ 3 - 0
internal/models/notification.go

@@ -17,6 +17,9 @@ type NotificationConfig struct {
 
 	LastNotifiedTime time.Time
 	NotifLimit       string
+
+	// Config is a JSONB column that stores arbitrary notification config
+	Config JSONB `json:"config" sql:"type:jsonb" gorm:"type:jsonb;default:'{}'"`
 }
 
 func (conf *NotificationConfig) ToNotificationConfigType() *types.NotificationConfig {