diff --git a/deploy/migrations/m0011_llm_usage_accounting_status_tri.json b/deploy/migrations/m0011_llm_usage_accounting_status_tri.json new file mode 100644 index 0000000..091f31d --- /dev/null +++ b/deploy/migrations/m0011_llm_usage_accounting_status_tri.json @@ -0,0 +1,25 @@ +{ + "id": "m0011", + "title": "llm_usage.accounting_status 三态语义(created/accounted/failed,2026-09-05用户定夺)——默认值改created,存量na/pending归一created;failed调用与recharge行由出账循环status='ok'门槛天然排除", + "backup_tables": ["llm_usage"], + "up": [ + { + "op": "sql", + "sql": "ALTER TABLE llm_usage MODIFY COLUMN accounting_status VARCHAR(20) NOT NULL DEFAULT 'created' COMMENT '记账状态(三态:created已创建待记账/accounted记账成功/failed记账失败)'" + }, + { + "op": "sql", + "sql": "UPDATE llm_usage SET accounting_status='created' WHERE accounting_status IN ('na','pending')" + } + ], + "down": [ + { + "op": "sql", + "sql": "ALTER TABLE llm_usage MODIFY COLUMN accounting_status VARCHAR(20) NOT NULL DEFAULT 'na' COMMENT '出账状态(本机构模型仅成本=na/owner模型待三方账=pending/已出账=accounted)'" + }, + { + "op": "sql", + "sql": "UPDATE llm_usage SET accounting_status='na' WHERE accounting_status='created'" + } + ] +}