| 1234567891011121314151617181920212223242526 |
- package tables
-
- import "git.x2erp.com/qdy/go-db/sqldef"
-
- func init() {
- sqldef.AddRegistration(func(r *sqldef.Registry) {
- // 启动配置表
- tb := sqldef.NewTable("config_startup", "启动配置表").
- ID("config_startup_id", 128).NotNull().Comment("主键ID").End(). // 默认VARCHAR(64)
- String("config_template_id", 64).NotNull().Comment("模板ID,关联config_template表").End().
- String("config_service_id", 64).NotNull().Comment("服务名称").End().
- String("config_environment_id", 8).NotNull().Default("'dev'").Comment("环境ID").End(). //dev/test
- Int("version").NotNull().Default("1").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_service_id", "config_service_id").
- AddIndex("idx_template_id", "config_template_id").
- AddIndex("idx_env_id", "config_environment_id")
-
- // 注册表
- r.RegisterTable(tb.Build())
- })
- }
|