From 638b292c0fc18fd99be01093bc9d4ef09d5fd83e Mon Sep 17 00:00:00 2001 From: yumoqing Date: Sat, 5 Sep 2026 18:19:53 +0800 Subject: [PATCH] =?UTF-8?q?feat(mig):=20m0011=20accounting=5Fstatus?= =?UTF-8?q?=E4=B8=89=E6=80=81=E5=BD=92=E4=B8=80(created/accounted/failed)?= =?UTF-8?q?=E2=80=94=E2=80=94=E9=BB=98=E8=AE=A4=E5=80=BC+=E5=AD=98?= =?UTF-8?q?=E9=87=8Fna/pending=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...m0011_llm_usage_accounting_status_tri.json | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 deploy/migrations/m0011_llm_usage_accounting_status_tri.json 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'" + } + ] +}