package schema import ( "entgo.io/ent" "entgo.io/ent/schema/edge" "entgo.io/ent/schema/field" "time" ) // Logentry holds the schema definition for the Logentry entity. type Logentry struct { ent.Schema } // Fields of the Logentry. func (Logentry) Fields() []ent.Field { return []ent.Field{ field.Int64("id"), field.Time("timestamp").Default(time.Now).Immutable(), field.String("action"), field.Text("data").Optional().Nillable(), field.Int64("account_id"), field.Int64("domain_id"), } } // Edges of the Logentry. func (Logentry) Edges() []ent.Edge { return []ent.Edge{ edge.From("account", Account.Type).Ref("logs").Field("account_id").Unique(), edge.From("domain", Domain.Type).Ref("logs").Field("domain_id").Unique(), } }