Files
ewoooc/migrations/010_ai_insights_decay_columns.sql
ogt 1b4f3a7bbe
Some checks failed
CD Pipeline / deploy (push) Failing after 59s
feat: EwoooC 初始化 — 完整專案推版至 Gitea
- 建立 Gitea Actions CD pipeline (.gitea/workflows/cd.yaml)
- 部署模式: rsync Python 檔案至 188 → docker restart (volume mount)
- Dockerfile/requirements 變動時自動重建 Docker image
- 部署通知: Telegram (開始/成功/失敗)
- 健康檢查: https://mo.wooo.work/health (最多 5 次重試)
- 同步最新 CLAUDE.md / ADR-008 / memory (2026-04-19)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-19 01:21:13 +08:00

24 lines
1.2 KiB
SQL
Raw Permalink 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.
-- ADR-005 + ADR-007: ai_insights 補齊品質分數時間衰減所需欄位
-- 日期: 2026-04-19
-- 相容性: PostgreSQL / SQLiteALTER ADD COLUMN IF NOT EXISTS 僅 PG 9.6+SQLite 需另處理)
-- 1. 品質分數(時間衰減公式的 Base_Score0.0~1.0
ALTER TABLE ai_insights ADD COLUMN IF NOT EXISTS avg_quality FLOAT DEFAULT 0.5;
-- 2. 審核狀態approved / pending / rejected / archived
ALTER TABLE ai_insights ADD COLUMN IF NOT EXISTS status VARCHAR(20) DEFAULT 'approved';
-- 3. 時間衰減豁免structural / constitutional 類設 TRUE
ALTER TABLE ai_insights ADD COLUMN IF NOT EXISTS decay_exempt BOOLEAN DEFAULT FALSE;
-- 4. AI 來源模型hermes3 / llama-3.1-8b / gemini-2.0-flash
ALTER TABLE ai_insights ADD COLUMN IF NOT EXISTS ai_model VARCHAR(50);
-- 5. 回饋統計
ALTER TABLE ai_insights ADD COLUMN IF NOT EXISTS feedback_up INTEGER DEFAULT 0;
ALTER TABLE ai_insights ADD COLUMN IF NOT EXISTS feedback_down INTEGER DEFAULT 0;
-- 6. 索引支援 RAG 查詢status + insight_type 複合)
CREATE INDEX IF NOT EXISTS idx_ai_insights_status_type ON ai_insights(status, insight_type);
CREATE INDEX IF NOT EXISTS idx_ai_insights_decay_exempt ON ai_insights(decay_exempt);