diff --git a/docker/postgres/init/01-init.sql b/docker/postgres/init/01-init.sql index b6d5f42..c272cac 100644 --- a/docker/postgres/init/01-init.sql +++ b/docker/postgres/init/01-init.sql @@ -56,6 +56,33 @@ CREATE TABLE IF NOT EXISTS products ( updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); +-- AI Insights — Code Review / Strategy / 洞察結果 +CREATE TABLE IF NOT EXISTS ai_insights ( + id SERIAL PRIMARY KEY, + insight_type VARCHAR(100) NOT NULL, + content TEXT, + confidence FLOAT DEFAULT 0.0, + created_by VARCHAR(100), + status VARCHAR(50) DEFAULT 'active', + metadata_json TEXT, + period VARCHAR(20), + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); +CREATE INDEX IF NOT EXISTS idx_ai_insights_type ON ai_insights(insight_type); +CREATE INDEX IF NOT EXISTS idx_ai_insights_created ON ai_insights(created_at DESC); + +-- Action Plans — Code Review 修復 / AIOps 派遣 +CREATE TABLE IF NOT EXISTS action_plans ( + id SERIAL PRIMARY KEY, + action_type VARCHAR(100) NOT NULL, + description TEXT, + status VARCHAR(50) DEFAULT 'pending', + priority INTEGER DEFAULT 3, + metadata_json TEXT, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); +CREATE INDEX IF NOT EXISTS idx_action_plans_type ON action_plans(action_type); + -- 授權給 momo 用戶 GRANT ALL PRIVILEGES ON ALL TABLES IN SCHEMA public TO momo; GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO momo;