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

View File

@@ -0,0 +1,34 @@
package model
import (
"time"
core "git.yuntuo.hk/k2safe/orbit/model"
)
// ScheduleVersion 表示已发布的不可变计划版本,记录规则与任务模板。
// 对应表 pulse_schedule_versions;这是服务端持久化模型,不直接作为 API 响应。
type ScheduleVersion struct {
// Record 包含命名空间、记录标识、并发版本和 UTC 时间。
core.Record
// ScheduleID 所属调度计划标识。
ScheduleID core.ID `db:"schedule_id"`
// Version 不可变发布版本;同版本不同内容必须拒绝。
Version uint64 `db:"version"`
// EffectiveAt 该计划版本开始生效的时间。
EffectiveAt time.Time `db:"effective_at"`
// Timezone 计划计算使用的 IANA 时区名称。
Timezone string `db:"timezone"`
// Specification 版本化规则定义 JSON;发布后禁止原地修改。
Specification core.JSON `db:"specification"`
// TaskTemplate 每次触发创建任务时采用的输入与策略模板。
TaskTemplate core.JSON `db:"task_template"`
// MisfirePolicy 漏跑策略:跳过、合并或有界补跑。
MisfirePolicy string `db:"misfire_policy"`
// OverlapPolicy 上次未完成时的策略:并行、串行或跳过。
OverlapPolicy string `db:"overlap_policy"`
// CatchupLimit 单次漏跑补偿上限;补跑策略必须配置正数。
CatchupLimit uint32 `db:"catchup_limit"`
}
func (ScheduleVersion) TableName() string { return "pulse_schedule_versions" }