Sin descripción
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

config_template.go 1.3KB

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