| 1234567891011121314151617181920212223242526272829303132333435363738394041 |
- package tables
-
- import (
- "time"
-
- "git.x2erp.com/qdy/go-db/sqldef"
- )
-
- func init() {
- sqldef.AddRegistration(func(r *sqldef.Registry) {
- tb := sqldef.NewTable("code_prompts", "代码提示词表").
- ID("id", 32).Comment("提示词ID,主键").End().
- String("session_id", 32).Comment("所属会话ID").End().
- String("project_id", 32).Comment("所属项目ID").End().
- String("module_path", 512).NotNull().Default("''").Comment("模块路径,树形结构").End().
- Text("prompt_text").NotNull().Comment("提示词内容").End().
- Text("result_text").Comment("结果内容").End().
- String("status", 16).NotNull().Default("pending").Comment("状态: pending, running, completed, failed").End().
- String("tenant_id", 8).NotNull().Comment("租户ID").End().
- String("creator", 32).NotNull().Comment("创建人").End().
- DateTime("created_at").NotNull().Default("CURRENT_TIMESTAMP").Comment("创建时间").End().
- DateTime("updated_at").NotNull().Default("CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP").Comment("更新时间").End()
- r.RegisterTable(tb.Build())
- })
- }
-
- type Prompt struct {
- ID string `gorm:"column:id;type:varchar(32);primaryKey;not null;comment:提示词ID,主键"`
- SessionID string `gorm:"column:session_id;type:varchar(32);comment:所属会话ID"`
- ProjectID string `gorm:"column:project_id;type:varchar(32);comment:所属项目ID"`
- ModulePath string `gorm:"column:module_path;type:varchar(512);not null;default:'';comment:模块路径,树形结构"`
- PromptText string `gorm:"column:prompt_text;type:text;not null;comment:提示词内容"`
- ResultText string `gorm:"column:result_text;type:text;comment:结果内容"`
- Status string `gorm:"column:status;type:varchar(16);not null;default:'pending';comment:状态: pending, running, completed, failed"`
- TenantID string `gorm:"column:tenant_id;type:varchar(8);not null;comment:租户ID"`
- Creator string `gorm:"column:creator;type:varchar(32);not null;comment:创建人"`
- CreatedAt time.Time `gorm:"column:created_at;not null;default:CURRENT_TIMESTAMP;comment:创建时间"`
- UpdatedAt time.Time `gorm:"column:updated_at;not null;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;comment:更新时间"`
- }
-
- func (Prompt) TableName() string { return "code_prompts" }
|