This commit is contained in:
2026-06-22 08:55:57 +08:00
parent dbb87823e8
commit 6ade6e8fa9
325 changed files with 41131 additions and 855 deletions
+21
View File
@@ -0,0 +1,21 @@
-- project_memory: durable, typed project knowledge with optional embeddings.
CREATE TABLE project_memory (
id uuid PRIMARY KEY,
project_id uuid NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
workspace_id uuid NULL REFERENCES workspaces(id) ON DELETE CASCADE,
kind text NOT NULL CHECK (kind IN ('decision','convention','file_map','gotcha')),
title text NOT NULL,
body text NOT NULL,
tags text[] NOT NULL DEFAULT '{}',
source text NOT NULL DEFAULT 'agent' CHECK (source IN ('agent','user','auto')),
embedding vector(1536) NULL,
embedding_model text NULL,
created_by uuid REFERENCES users(id),
created_at timestamptz NOT NULL DEFAULT now(),
updated_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX idx_project_memory_proj ON project_memory (project_id, kind);
CREATE INDEX idx_project_memory_embedding ON project_memory USING hnsw (embedding vector_cosine_ops)
WHERE embedding IS NOT NULL;
CREATE INDEX idx_project_memory_tags ON project_memory USING gin (tags);