Files
streamline/drizzle/0026_eddy_compat.sql
2026-11-16 17:26:44 -08:00

114 lines
3.2 KiB
SQL

-- Eddy(本地 Catalyst 原型运行时)的共享兼容知识:基线登记、问题(signature)、观察遥测、
-- 候选/已发布修法、advisory、交接包。设计见 streamline_playground/API.md 与设计文档 §07。
--
-- 表之间只用字符串键关联(baseline id、signature、fix id@rev),不加外键:客户端先于
-- 登记就可能上报观察(离线缓冲后补发),外键会把这类迟到数据整批拒掉。
-- JSON 一律存 TEXT(与 clusters / ttkb_packages 一致),载体(guard.js / launch.json /
-- pack.zip)按 base64 存 TEXT,上限由路由控制(20 MB);迁到 TOS 是后续优化,不改契约。
CREATE TABLE IF NOT EXISTS "eddy_baselines" (
"id" text PRIMARY KEY,
"key" text NOT NULL,
"identity" text NOT NULL,
"signing" text,
"devicesim_commit" text,
"eddy_release" text,
"adhoc_packs" text,
"artifact" text,
"registered_at" bigint NOT NULL,
"seen_by" text
);
CREATE TABLE IF NOT EXISTS "eddy_problems" (
"signature" text NOT NULL,
"baseline" text NOT NULL,
"kind" text NOT NULL,
"status" text NOT NULL DEFAULT 'open',
"scope" text,
"aliases" text,
"first_seen" bigint NOT NULL,
"last_seen" bigint NOT NULL,
PRIMARY KEY ("signature", "baseline")
);
CREATE TABLE IF NOT EXISTS "eddy_observations" (
"id" text PRIMARY KEY,
"ts" bigint NOT NULL,
"baseline" text NOT NULL,
"signature" text NOT NULL,
"kind" text,
"machine" text,
"user_name" text,
"macos" text,
"eddy_release" text,
"payload" text
);
CREATE INDEX IF NOT EXISTS "eddy_observations_baseline_sig" ON "eddy_observations" ("baseline", "signature");
CREATE TABLE IF NOT EXISTS "eddy_installs" (
"id" text PRIMARY KEY,
"ts" bigint NOT NULL,
"baseline" text NOT NULL,
"fix" text NOT NULL,
"rev" bigint NOT NULL,
"status" text NOT NULL,
"machine" text,
"user_name" text,
"kind" text
);
CREATE INDEX IF NOT EXISTS "eddy_installs_fix" ON "eddy_installs" ("fix", "rev");
CREATE TABLE IF NOT EXISTS "eddy_fixes" (
"id" text NOT NULL,
"rev" bigint NOT NULL,
"baseline" text NOT NULL,
"tier" text NOT NULL,
"problem" text NOT NULL,
"title" text,
"contract" text,
"target" text,
"payload_name" text,
"payload_sha" text,
"payload" text,
"manifest" text,
"manifest_sha" text,
"author" text,
"created" bigint NOT NULL,
"state" text NOT NULL DEFAULT 'candidate',
"evidence" text,
"verify" text,
"verification" text,
PRIMARY KEY ("id", "rev")
);
CREATE INDEX IF NOT EXISTS "eddy_fixes_baseline" ON "eddy_fixes" ("baseline");
CREATE TABLE IF NOT EXISTS "eddy_advisories" (
"id" text PRIMARY KEY,
"baseline" text NOT NULL,
"problem" text,
"title" text,
"body" text NOT NULL,
"scope" text,
"state" text NOT NULL DEFAULT 'unverified',
"author" text,
"created" bigint NOT NULL,
"manual" bigint NOT NULL DEFAULT 0
);
CREATE INDEX IF NOT EXISTS "eddy_advisories_baseline" ON "eddy_advisories" ("baseline");
CREATE TABLE IF NOT EXISTS "eddy_handoffs" (
"id" text PRIMARY KEY,
"feature_id" text,
"task" text,
"key" text,
"bundle" text,
"area" text,
"title" text,
"summary" text,
"baseline" text,
"author" text,
"created" bigint NOT NULL,
"manifest" text,
"zip" text
);