persisting in postgres

This commit is contained in:
2026-03-06 15:26:55 -07:00
parent b9db6408b1
commit 8059048db2
13 changed files with 255 additions and 46 deletions

18
schema.sql Normal file
View File

@@ -0,0 +1,18 @@
CREATE TABLE conversations (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name TEXT NOT NULL UNIQUE,
inserted_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
CREATE TABLE messages (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
conversation_id UUID NOT NULL REFERENCES conversations(id) ON DELETE CASCADE,
role TEXT NOT NULL CHECK (role IN ('user', 'assistant', 'tool')),
content TEXT,
reasoning_content TEXT,
tool_calls JSONB,
tool_call_id TEXT,
position INTEGER NOT NULL,
inserted_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);