From 9bc3a3b5fe5774b3e05223ebf97efe0999b40300 Mon Sep 17 00:00:00 2001 From: seonNoh Date: Thu, 8 Oct 2026 02:33:54 +0900 Subject: [PATCH] fix(rag): add the diagnosis column to existing hitl_messages tables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 첫 이미지(f30af2a)가 만든 ai.hitl_messages에는 diagnosis 컬럼이 없어 /post의 insert가 42703으로 실패했다(실측). CREATE TABLE IF NOT EXISTS는 기존 테이블을 바꾸지 않으므로 ADD COLUMN IF NOT EXISTS를 스키마 적용 단계에 추가한다. --- ai/internal/rag/store.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ai/internal/rag/store.go b/ai/internal/rag/store.go index 6328afd..bafaeec 100644 --- a/ai/internal/rag/store.go +++ b/ai/internal/rag/store.go @@ -67,7 +67,9 @@ CREATE TABLE IF NOT EXISTS ai.hitl_messages ( decided_by text, result jsonb, created_at timestamptz NOT NULL DEFAULT now() -);` +); +-- additive migrations (CREATE TABLE IF NOT EXISTS leaves existing tables untouched; seen 2026-10-08 on the AI VM) +ALTER TABLE ai.hitl_messages ADD COLUMN IF NOT EXISTS diagnosis jsonb NOT NULL DEFAULT '{}'::jsonb;` func New(ctx context.Context, dsn string) (*Store, error) { pool, err := pgxpool.New(ctx, dsn)