Files
ssw-mvp/boot/db/sswflow/V1.1.0__dataset_external_ref.sql
T
admin f9899ea207 feat: TDS × SSWFLOW 胶水全 V0–V1.4 落地 + DB 0813 v2 导出
V0 触发链 + 回调链(架构原承诺「SSWFLOW 被合约驱动调用」)
- tds/ContractSswflowTrigger: 合约双签 → 解析 f_policy_content.sswflowFlowId → SswflowClient.startRun → 回写 f_flow_run_id
- sswflow/FlowRunInternalController: /Internal/Start 白名单 App-Code (tds/tdc)
- sswflow/TdsCallbackClient + tds/RunCallbackService: 终态回调 → tds_chain_evidence (bizType=SSW_FLOW_RUN_FINISH)

V1.1 合约触发 + V1.2 dataset 同步 + V1.3 对账调度 + V1.4 TDC 直触发
- tds/DataProductDatasetSyncer: 上架 → /Dataset/Internal/Sync 按 f_external_ref='tds:dataProduct:<id>' upsert
- tds/FlowRunReconciliationScheduler: @Scheduled cron 扫合约漏单 → SswflowClient.getRun → 终态写 ledger + f_quota_used++
- tdc/DeliveryTaskController + TdcSswflowClient: /TriggerFlow 走 Internal/Start (trigger=DELIVERY_DIRECT,绕合约)

3 个 migration(必须按 V1.4→V1.5→V1.1 顺序跑)
- boot/db/tds/V1.4.0__tds_contract_flow_run_id.sql: tds_contract.f_flow_run_id + idx
- boot/db/tds/V1.5.0__tds_billing_ledger_run_id.sql: tds_billing_ledger.f_run_id + idx
- boot/db/sswflow/V1.1.0__dataset_external_ref.sql: dataset.f_external_ref + unique idx

配置 + 文档
- application.yml: exclude-url 加 Dataset/Internal/** + ssw.reconciliation 默认 + ssw.tds.callback.*
- docs/tds/SSWFLOW_BINDING.md: §10 V1.1–V1.4 全标 ✅
- docs/db/0813/{sswflow,tds,tdc,j7}/: schema 含新字段
2026-08-13 16:38:01 +08:00

18 lines
782 B
SQL
Raw 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.
-- ============================================================
-- V1.1.0 dataset 加 external_ref 字段(TDS 数据产品桥接)
-- 依据 : docs/tds/SSWFLOW_BINDING.md §10 V1.2
-- 范围 : 仅 sswflow 库 dataset 表
-- 回滚 : ALTER TABLE dataset DROP COLUMN IF EXISTS f_external_ref;
-- DROP INDEX IF EXISTS uq_dataset_external_ref;
-- ============================================================
ALTER TABLE dataset
ADD COLUMN IF NOT EXISTS f_external_ref varchar(128);
COMMENT ON COLUMN dataset.f_external_ref
IS '外部系统引用 ID(tds:dataProduct:xxx),用于跨子系统反查;唯一索引保证同步幂等';
CREATE UNIQUE INDEX IF NOT EXISTS uq_dataset_external_ref
ON dataset(f_external_ref)
WHERE f_external_ref IS NOT NULL;