mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-09 19:47:47 +08:00
db optimize
This commit is contained in:
34
ent/schema/episode.go
Normal file
34
ent/schema/episode.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package schema
|
||||
|
||||
import (
|
||||
"entgo.io/ent"
|
||||
"entgo.io/ent/schema/edge"
|
||||
"entgo.io/ent/schema/field"
|
||||
)
|
||||
|
||||
// Episode holds the schema definition for the Epidodes entity.
|
||||
type Episode struct {
|
||||
ent.Schema
|
||||
}
|
||||
|
||||
// Fields of the Episode.
|
||||
func (Episode) Fields() []ent.Field {
|
||||
return []ent.Field{
|
||||
//field.Int("series_id"),
|
||||
field.Int("season_number"),
|
||||
field.Int("episode_number"),
|
||||
field.String("title"),
|
||||
field.String("overview"),
|
||||
field.String("air_date"),
|
||||
}
|
||||
}
|
||||
|
||||
// Edges of the Episode.
|
||||
func (Episode) Edges() []ent.Edge {
|
||||
return []ent.Edge{
|
||||
edge.From("series", Series.Type).
|
||||
Ref("episodes").
|
||||
Unique(),
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user