14 lines
592 B
SQL
14 lines
592 B
SQL
CREATE TABLE IF NOT EXISTS rag_answer_feedback (
|
|
feedback_id uuid PRIMARY KEY,
|
|
trace_id uuid NOT NULL REFERENCES rag_retrieval_trace(trace_id) ON DELETE CASCADE,
|
|
conversation_id varchar(128),
|
|
rating varchar(16) NOT NULL CHECK (rating IN ('helpful', 'not_helpful')),
|
|
comment text CHECK (comment IS NULL OR char_length(comment) <= 2000),
|
|
created_at timestamptz NOT NULL DEFAULT now(),
|
|
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
UNIQUE (trace_id)
|
|
);
|
|
|
|
CREATE INDEX IF NOT EXISTS rag_answer_feedback_created_at_idx
|
|
ON rag_answer_feedback (created_at DESC);
|