fix(cd-blocker-2): setup_test_schema.sql 補 KM 欄位(解 CD 真實 root cause)
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 14m4s
All checks were successful
CD Pipeline / build-and-deploy (push) Successful in 14m4s
## 之前c5b18101修錯地方 我加 db/base.py:init_db() ALTER 沒解問題。**CI 不跑 init_db()**。 ## 真實 CD 流程 `.gitea/workflows/cd.yaml` Integration Tests step: 1. 啟動臨時 `pg-test-b5` 容器(fresh PG) 2. `psql -f tests/integration/setup_test_schema.sql` 建表 3. 跑 pytest tests/integration/test_b5_core_flows.py setup_test_schema.sql 的 `knowledge_entries` 表沒有 `related_approval_id` + `path_type` 欄位 → INSERT 失敗。 ## 修法 setup_test_schema.sql:110 `CREATE TABLE knowledge_entries` 補: - related_approval_id VARCHAR(64) - path_type VARCHAR(50) - uix_knowledge_incident_path partial unique index - ix_knowledge_related_approval partial index ## 預期效果 CD #1119 (本 commit) 應該成功。 解鎖 4 個 stuck commit (1114-1118) 的部署 backlog。fb0c72db推翻 A2 DIAGNOSE Ollama primary 終於上 prod。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -119,11 +119,24 @@ CREATE TABLE IF NOT EXISTS knowledge_entries (
|
||||
related_incident_id VARCHAR,
|
||||
related_playbook_id VARCHAR,
|
||||
symptoms_hash VARCHAR,
|
||||
-- 2026-04-29 ogt + Claude Opus 4.7: M4 KMWriter 反查鏈 + 冪等補欄
|
||||
-- 解 CD #1115-1118 全 failure:column "related_approval_id" does not exist
|
||||
-- 對應 commit c22e5f33 KMWriter ORM 加的欄位
|
||||
related_approval_id VARCHAR(64),
|
||||
path_type VARCHAR(50),
|
||||
view_count INTEGER DEFAULT 0,
|
||||
created_by VARCHAR,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
|
||||
);
|
||||
-- M3 冪等 unique index (incident_id + path_type)
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS uix_knowledge_incident_path
|
||||
ON knowledge_entries(related_incident_id, path_type)
|
||||
WHERE related_incident_id IS NOT NULL AND path_type IS NOT NULL;
|
||||
-- M4 反查鏈 partial index
|
||||
CREATE INDEX IF NOT EXISTS ix_knowledge_related_approval
|
||||
ON knowledge_entries(related_approval_id)
|
||||
WHERE related_approval_id IS NOT NULL;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS rag_chunks (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
|
||||
Reference in New Issue
Block a user