Initial import of streamline
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
-- 批量导入的留痕(口径见 shared/src/batch_import_log.ts,实现见 control-server/src/batch_import_log.ts)。
|
||||
--
|
||||
-- 导入 job 只活在控制面内存里,面板一关、控制面一重启,「为什么这几张没导进来」就查不到了。
|
||||
-- 这里把每一次导入和每张单的结果、原因落库,批次详情的「导入记录」读它,重试 / 忽略也写它。
|
||||
--
|
||||
-- 全是新表,不需要回填:留痕上线前导入的批次,第一次打开「导入记录」时由代码按
|
||||
-- batch_view_seen(origin = import)和 tasks 现推一份(kind = legacy),没导进来的再补查原因。
|
||||
|
||||
-- 每一次导入:新建向导(import)、事后重试(retry)、按旧数据现推的(legacy)。
|
||||
CREATE TABLE IF NOT EXISTS "batch_imports" (
|
||||
"id" text PRIMARY KEY,
|
||||
"tag" text NOT NULL,
|
||||
"kind" text NOT NULL,
|
||||
"started_by" text,
|
||||
"started_at" bigint NOT NULL,
|
||||
"finished_at" bigint,
|
||||
"source" text,
|
||||
-- 导入时的设置(集群、通知群、无人值守、语言),JSON。重试沿用最近一次的。
|
||||
"settings" text,
|
||||
"total" bigint NOT NULL DEFAULT 0,
|
||||
"created" bigint NOT NULL DEFAULT 0,
|
||||
"retagged" bigint NOT NULL DEFAULT 0,
|
||||
"set_aside" bigint NOT NULL DEFAULT 0,
|
||||
"failed" bigint NOT NULL DEFAULT 0,
|
||||
"error" text
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS "batch_imports_tag_started" ON "batch_imports" ("tag", "started_at" DESC);
|
||||
|
||||
-- 每张单最近一次的结果。outcome:created / retagged / set_aside / failed / pending。
|
||||
-- reason:set_aside 时是检查桶或 manual / unknown,failed 时是错误原文。
|
||||
-- evidence:检查时看到的依据(Meego 状态、绑定的 MR……),JSON。
|
||||
-- ignored_at / ignored_by:有人点了「忽略」,不再算进待处理;结果和原因原样保留。
|
||||
CREATE TABLE IF NOT EXISTS "batch_import_items" (
|
||||
"tag" text NOT NULL,
|
||||
"meego_id" text NOT NULL,
|
||||
"url" text NOT NULL,
|
||||
"title" text,
|
||||
"outcome" text NOT NULL,
|
||||
"reason" text,
|
||||
"evidence" text,
|
||||
"task_id" text,
|
||||
"run_id" text,
|
||||
"attempts" bigint NOT NULL DEFAULT 0,
|
||||
"updated_at" bigint NOT NULL,
|
||||
"ignored_at" bigint,
|
||||
"ignored_by" text,
|
||||
PRIMARY KEY ("tag", "meego_id")
|
||||
);
|
||||
Reference in New Issue
Block a user