33 lines
842 B
Go
33 lines
842 B
Go
package schema
|
|||
|
|
|
||
|
|
import (
|
||
|
|
"time"
|
||
|
|
|
||
|
|
"entgo.io/ent"
|
||
|
|
"entgo.io/ent/schema/field"
|
||
|
|
"entgo.io/ent/schema/index"
|
||
|
|
)
|
||
|
|
|
||
|
|
// ProcessDict 工序字典:12 道工序可维护,用户自定义描述做什么操作等
|
||
|
|
type ProcessDict struct {
|
||
|
|
ent.Schema
|
||
|
|
}
|
||
|
|
|
||
|
|
func (ProcessDict) Fields() []ent.Field {
|
||
|
|
return []ent.Field{
|
||
|
|
field.Int("code").Unique().Comment("工序号 1~12"),
|
||
|
|
field.String("name").Comment("工序名称"),
|
||
|
|
field.String("description").Optional().Comment("该工序做什么操作的描述"),
|
||
|
|
field.Int("sort_num").Default(0).Comment("排序"),
|
||
|
|
field.Bool("enabled").Default(true),
|
||
|
|
field.Time("created_at").Default(time.Now).Immutable(),
|
||
|
|
field.Time("updated_at").Default(time.Now).UpdateDefault(time.Now).Optional().Nillable(),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func (ProcessDict) Indexes() []ent.Index {
|
||
|
|
return []ent.Index{
|
||
|
|
index.Fields("code"),
|
||
|
|
}
|
||
|
|
}
|