From a0ba6cc13cd0235f7c457d312d026a524521f6ce Mon Sep 17 00:00:00 2001 From: Aditya Thebe Date: Mon, 23 Dec 2024 17:57:35 +0545 Subject: [PATCH] feat: allow silence to never expire --- models/notifications.go | 12 ++++++------ schema/notifications.hcl | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/models/notifications.go b/models/notifications.go index 39fc792d..a37a3698 100644 --- a/models/notifications.go +++ b/models/notifications.go @@ -182,20 +182,20 @@ type NotificationSilence struct { NotificationSilenceResource `json:",inline" yaml:",inline"` ID uuid.UUID `json:"id" gorm:"default:generate_ulid()"` - Namespace string `json:"namespace,omitempty"` + Namespace string `json:"namespace,omitempty" gorm:"default:NULL"` Name string `json:"name,omitempty"` - Filter types.CelExpression `json:"filter,omitempty"` - From time.Time `json:"from"` - Until time.Time `json:"until"` + Filter types.CelExpression `json:"filter,omitempty" gorm:"default:NULL"` + From *time.Time `json:"from,omitempty"` + Until *time.Time `json:"until,omitempty"` Source string `json:"source"` Recursive bool `json:"recursive"` - Description string `json:"description,omitempty"` + Description *string `json:"description,omitempty" gorm:"default:NULL"` CreatedBy *uuid.UUID `json:"created_by,omitempty"` CreatedAt time.Time `json:"created_at" time_format:"postgres_timestamp" gorm:"<-:false"` UpdatedAt time.Time `json:"updated_at" time_format:"postgres_timestamp" gorm:"<-:false"` DeletedAt *time.Time `json:"deleted_at,omitempty"` - Selectors types.JSON `json:"selectors,omitempty"` + Selectors types.JSON `json:"selectors,omitempty" gorm:"default:NULL"` // Error contains cel expression error in the filter Error *string `json:"error,omitempty"` diff --git a/schema/notifications.hcl b/schema/notifications.hcl index 49eaf68a..aac4efe8 100644 --- a/schema/notifications.hcl +++ b/schema/notifications.hcl @@ -230,7 +230,7 @@ table "notification_silences" { default = sql("generate_ulid()") } column "namespace" { - null = false + null = true type = text } column "name" { @@ -256,11 +256,11 @@ table "notification_silences" { type = text } column "from" { - null = false + null = true type = timestamptz } column "until" { - null = false + null = true type = timestamptz } column "recursive" {