-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.sql
More file actions
23 lines (20 loc) · 800 Bytes
/
schema.sql
File metadata and controls
23 lines (20 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
-- Enable pgvector (run once in Vercel Postgres SQL tab or psql)
CREATE EXTENSION IF NOT EXISTS vector;
-- Thoughts table: raw text, embedding, metadata
CREATE TABLE thoughts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
raw_text TEXT NOT NULL,
embedding vector(1536), -- OpenAI text-embedding-3-small default
people TEXT[] DEFAULT '{}',
topics TEXT[] DEFAULT '{}',
type TEXT, -- e.g. "idea", "meeting_note", "task", "reflection"
action_items TEXT[] DEFAULT '{}',
source_channel TEXT,
source_user TEXT,
created_at TIMESTAMPTZ DEFAULT NOW()
);
-- HNSW index for fast semantic search
CREATE INDEX ON thoughts USING hnsw (embedding vector_cosine_ops)
WITH (m = 16, ef_construction = 64);
-- Index for recent listing
CREATE INDEX ON thoughts (created_at DESC);