| 123456789101112131415161718192021222324252627282930 |
- // config_template.go
- package tables
-
- import "git.x2erp.com/qdy/go-db/sqldef"
-
- func init() {
- sqldef.AddRegistration(func(r *sqldef.Registry) {
- // 配置模版表
- tb := sqldef.NewTable("config_template", "配置模版").
- ID("config_template_id", 128).NotNull().Comment("主键ID").End().
- String("template_name", 64).NotNull().Comment("模版名称").End().
- //String("yaml_root_key", 32).NotNull().Comment("YAML配置的根节点名称").End().
- //String("service_type", 32).Comment("适用服务类型,如:auth/order/payment").End().
- Bool("is_default").NotNull().Default("0").Comment("是否默认模版").End().
- Int("sort_order").NotNull().Default("0").Comment("排序号,小的在前").End().
- Text("description").Comment("模版说明").End().
- String("creator", 32).NotNull().Comment("创建人").End().
- DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
- DateTime("updated_at").Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End()
-
- // 添加索引
- //tb.AddIndex("idx_type_code", "yaml_root_key")
- //AddIndex("idx_service_type", "service_type").
- tb.AddIndex("idx_sort_order", "sort_order")
- //AddUniqueIndex("uk_name_type", "template_name", "yaml_root_key")
-
- // 注册表
- r.RegisterTable(tb.Build())
- })
- }
|