fix: database target writes to dedicated archive table
All checks were successful
check / check (push) Successful in 1m43s
All checks were successful
check / check (push) Successful in 1m43s
The "database" target type now writes events to a separate archived_events table instead of just marking the delivery as done. This table persists independently of internal event retention/pruning, allowing the data to be consumed by external systems or preserved indefinitely. New ArchivedEvent model copies the full event payload (method, headers, body, content_type) along with webhook/entrypoint/event/target IDs.
This commit is contained in:
19
internal/database/model_archived_event.go
Normal file
19
internal/database/model_archived_event.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package database
|
||||
|
||||
// ArchivedEvent stores webhook events delivered via the "database" target type.
|
||||
// These records persist independently of internal event retention and pruning,
|
||||
// providing a durable archive for downstream consumption.
|
||||
type ArchivedEvent struct {
|
||||
BaseModel
|
||||
|
||||
WebhookID string `gorm:"type:uuid;not null;index" json:"webhook_id"`
|
||||
EntrypointID string `gorm:"type:uuid;not null" json:"entrypoint_id"`
|
||||
EventID string `gorm:"type:uuid;not null" json:"event_id"`
|
||||
TargetID string `gorm:"type:uuid;not null" json:"target_id"`
|
||||
|
||||
// Original request data (copied from Event at archive time)
|
||||
Method string `gorm:"not null" json:"method"`
|
||||
Headers string `gorm:"type:text" json:"headers"` // JSON
|
||||
Body string `gorm:"type:text" json:"body"`
|
||||
ContentType string `json:"content_type"`
|
||||
}
|
||||
Reference in New Issue
Block a user