34 lines
703 B
Go
34 lines
703 B
Go
package schema
|
|
|
|
import (
|
|
"entgo.io/ent"
|
|
"entgo.io/ent/schema/edge"
|
|
"entgo.io/ent/schema/field"
|
|
"time"
|
|
)
|
|
|
|
// Alias holds the schema definition for the Alias entity.
|
|
type Alias struct {
|
|
ent.Schema
|
|
}
|
|
|
|
// Fields of the Alias.
|
|
func (Alias) Fields() []ent.Field {
|
|
return []ent.Field{
|
|
field.Int64("id"),
|
|
field.Time("created").Default(time.Now).Immutable(),
|
|
field.Time("modified").Default(time.Now).UpdateDefault(time.Now).Nillable().Optional(),
|
|
field.Int64("domain_id").Optional(),
|
|
field.Text("goto"),
|
|
field.Bool("active"),
|
|
}
|
|
|
|
}
|
|
|
|
// Edges of the Alias.
|
|
func (Alias) Edges() []ent.Edge {
|
|
return []ent.Edge{
|
|
edge.From("domain", Domain.Type).Ref("aliases").Field("domain_id").Unique(),
|
|
}
|
|
}
|