Skip to content

Commit

Permalink
fix: config change first observed
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Aug 20, 2024
1 parent e14697a commit c8156ae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion models/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ type ConfigChange struct {
CreatedAt *time.Time `json:"created_at"`

// FirstObserved represents the timestamp when this change was first observed.
FirstObserved *time.Time `gorm:"first_observed" json:"first_observed,omitempty"`
FirstObserved *time.Time `gorm:"first_observed;default:now()" json:"first_observed,omitempty"`

// Count is the number of occurrences of this change, including duplicates detected by fingerprinting
Count int `json:"count"`
Expand Down
11 changes: 6 additions & 5 deletions schema/config.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ table "config_changes" {
}

column "count" {
null = true
type = int
null = false
default = 1
type = int
}

column "fingerprint" {
Expand All @@ -166,11 +167,11 @@ table "config_changes" {
}

column "first_observed" {
null = true
type = timestamptz
null = false
default = sql("now()")
type = timestamptz
}


column "is_pushed" {
null = false
default = false
Expand Down

0 comments on commit c8156ae

Please sign in to comment.