feat: establish Orbit models, migrations and development baseline

This commit is contained in:
2026-09-17 07:04:21 +08:00
commit 4f2935e36f
84 changed files with 4915 additions and 0 deletions

32
weave/model/activation.go Normal file
View File

@@ -0,0 +1,32 @@
package model
import (
"time"
core "git.yuntuo.hk/k2safe/orbit/model"
)
// Activation 表示步骤的一次具体激活,人工恢复通过新激活保留历史。
// 对应表 weave_activations;这是服务端持久化模型,不直接作为 API 响应。
type Activation struct {
// Record 包含命名空间、记录标识、并发版本和 UTC 时间。
core.Record
// WorkflowID 所属流程实例标识。
WorkflowID core.ID `db:"workflow_id"`
// StepID 所属逻辑步骤标识。
StepID core.ID `db:"step_id"`
// Sequence 同一步骤的激活序号,人工恢复递增并保留旧记录。
Sequence uint32 `db:"sequence"`
// State 当前状态;只允许定义的状态转换并配合事务校验。
State StepState `db:"state"`
// TaskID 关联的 Pulse 任务标识;可为空,表示尚未设置该关联或值。
TaskID *core.ID `db:"task_id"`
// Input 本次实例或步骤激活的输入快照 JSON。
Input core.JSON `db:"input"`
// Output 已保存的输出 JSON;未完成时可以为空。
Output core.JSON `db:"output"`
// CompletedAt 终结时间;非终态为空,进入终态时必须写入。
CompletedAt *time.Time `db:"completed_at"`
}
func (Activation) TableName() string { return "weave_activations" }