瀏覽代碼

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

d-g-town 2 年之前
父節點
當前提交
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 {