style(db): 对齐 ICP 范围匹配 SQL 缩进,并注明手工挂载资产的语句顺序依赖
#53 引入 icp 范围匹配时,三处覆盖度 CTE 里新增的 OR 分支混进了 tab 缩进, 与同一 JOIN 条件内其它分支(纯空格)不一致。统一改回空格,SQL 语义未变 (git diff -w 无差异)。 AttachAssetsToTask 里 UPDATE assets 会先触发 trg_assets_task_links 写入 source='system',随后的显式 INSERT 才把来源改成 'manual'。加注释说明这层 顺序依赖,避免后续调换两条语句导致人工挂载的来源静默退化成 system。
This commit is contained in:
1 parent
6b44a94ec7
commit
3eca390089
3 files changed
+23
-19
No files matched your search
@@ -288,6 +288,10 @@ FROM assets WHERE id=ANY($2::bigint[])`, taskID, assetIDs).Scan(&found, &existin
|
||||
if found != len(assetIDs) {
|
||||
return mutation, ErrTaskAssetAssetNotFound
|
||||
}
|
||||
// Order matters: this UPDATE fires trg_assets_task_links, which creates the
|
||||
// link rows with the generic source='system'. The INSERT below must stay
|
||||
// after it so the operator-authored 'manual' provenance wins; swapping the
|
||||
// two statements silently degrades every manual attach back to 'system'.
|
||||
if _, err := tx.Exec(`
|
||||
UPDATE assets
|
||||
SET task_ids=CASE WHEN $1=ANY(task_ids) THEN task_ids ELSE array_append(task_ids,$1) END
|
||||
|
||||
Reference in new issue
Block a user