fix(ci): test_schema 加 P2.1 fusion 欄位 — 解 CI 1162-1172 阻塞
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
Some checks failed
CD Pipeline / build-and-deploy (push) Has been cancelled
Production PG migration 已上線(commit c58bdd0c),但 CI 用獨立 docker pgvector
test container(pg-test-b5),由 setup_test_schema.sql 初始化 → 無 fusion 欄位
→ test_b5_core_flows.py 整合測試失敗於 composite_score column does not exist。
修法:把 P2.1 ALTER TABLE 加入 setup_test_schema.sql(idempotent IF NOT EXISTS)
新增(對齊 production p2_decision_fusion_columns.sql):
- composite_score REAL
- complexity_tier VARCHAR(16) + CHECK ('low','medium','high','critical')
- decision_fusion_details JSONB
partial index 不需要在 test schema(B5 整合測試不依賴 index)。
DO $$ block 處理 CHECK constraint 因 PG 不支援 ADD CONSTRAINT IF NOT EXISTS。
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -77,6 +77,24 @@ CREATE TABLE IF NOT EXISTS approval_records (
|
||||
resolved_at TIMESTAMPTZ
|
||||
);
|
||||
|
||||
-- 2026-04-27 P2.1 DecisionFusion 欄位(對齊 p2_decision_fusion_columns.sql 已上 production)
|
||||
-- IF NOT EXISTS 形式 idempotent,重跑安全
|
||||
ALTER TABLE approval_records
|
||||
ADD COLUMN IF NOT EXISTS composite_score REAL,
|
||||
ADD COLUMN IF NOT EXISTS complexity_tier VARCHAR(16),
|
||||
ADD COLUMN IF NOT EXISTS decision_fusion_details JSONB;
|
||||
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (SELECT 1 FROM pg_constraint WHERE conname = 'chk_complexity_tier') THEN
|
||||
ALTER TABLE approval_records
|
||||
ADD CONSTRAINT chk_complexity_tier CHECK (
|
||||
complexity_tier IS NULL
|
||||
OR complexity_tier IN ('low','medium','high','critical')
|
||||
);
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS knowledge_entries (
|
||||
id VARCHAR(36) PRIMARY KEY,
|
||||
title VARCHAR NOT NULL,
|
||||
|
||||
Reference in New Issue
Block a user