pipeline-app/deploy/migrations/m0021_llm_usage_drop_token_cols.json
yumoqing 220901ff61 feat(migration): m0021删llm_usage token冗余列+m0025加project_id列索引(2026-09-10用户定夺,配对pipeline-llm@427cd7c)
- m0021: usages JSON全量不截断为计费唯一事实源,req_tokens/resp_tokens同源冗余删除,
  统计查询走JSON_EXTRACT+JSON_VALID守卫;backup_tables含llm_usage,dmig幂等(列不存在跳过)
- m0025: 按项目统计费用,project_id NOT NULL DEFAULT '0'(哨兵=非项目调用,对齐org_id平台约定),
  idx_llm_usage_project(project_id,created_at);token绑定project_id全链透传落库
- 两迁移id字段与文件名一致性已校验;llm_call_trace新表走create_tables.py动态扫描models建表,无需迁移
2026-09-11 15:30:24 +08:00

14 lines
832 B
JSON
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
"id": "m0021",
"title": "llm_usage 删除 req_tokens/resp_tokens 冗余列2026-09-10 用户定夺usages JSON 是计费唯一事实源token 计数在其中;两列与 usages 同源冗余且曾被截断病根牵连,统计查询改 JSON_EXTRACT。dmig 幂等守卫:列已不存在自动跳过",
"backup_tables": ["llm_usage"],
"up": [
{"op": "sql", "sql": "ALTER TABLE llm_usage DROP COLUMN req_tokens"},
{"op": "sql", "sql": "ALTER TABLE llm_usage DROP COLUMN resp_tokens"}
],
"down": [
{"op": "sql", "sql": "ALTER TABLE llm_usage ADD COLUMN req_tokens INT NOT NULL DEFAULT 0 COMMENT '请求token(历史冗余列,计费看usages)'"},
{"op": "sql", "sql": "ALTER TABLE llm_usage ADD COLUMN resp_tokens INT NOT NULL DEFAULT 0 COMMENT '响应token(历史冗余列,计费看usages)'"}
]
}