crowdsec/pkg/database/ent/schema/event.go
Thibault "bui" Koechlin fc7369c4ea
Fix big serialized entries (#877)
* bump serialized to 8k

* handle oversized serialized entry : progressively strip its size down
2021-08-03 15:46:10 +02:00

35 lines
603 B
Go

package schema
import (
"time"
"entgo.io/ent"
"entgo.io/ent/schema/edge"
"entgo.io/ent/schema/field"
)
// Event holds the schema definition for the Event entity.
type Event struct {
ent.Schema
}
// Fields of the Event.
func (Event) Fields() []ent.Field {
return []ent.Field{
field.Time("created_at").
Default(time.Now),
field.Time("updated_at").
Default(time.Now),
field.Time("time"),
field.String("serialized").MaxLen(8191),
}
}
// Edges of the Event.
func (Event) Edges() []ent.Edge {
return []ent.Edge{
edge.From("owner", Alert.Type).
Ref("events").
Unique(),
}
}