W
AI-Wiki

AI · 源文件

入库前的原始上传文件存档。点击左侧文件名可预览文件内容。

Database Architecture.md1.4 KBit/ai/Database Architecture.md
---
title: "Database Architecture"
source_url: "https://docs.claude-mem.ai/architecture/database"
source_site: "docs.claude-mem.ai"
clipped_at: "2026-07-07T00:56:16.785785+00:00"
clipper: "aiwiki-url-ingest"
extractor: "readability_static"
source_strategy: "normal_web_clip"
source_strategy_label: "普通网页抓取"
---

# Database Architecture

```
-- Insert trigger example
CREATE TRIGGER observations_ai AFTER INSERT ON observations BEGIN
 INSERT INTO observations_fts(rowid, title, subtitle, narrative, text, facts, concepts)
 VALUES (new.id, new.title, new.subtitle, new.narrative, new.text, new.facts, new.concepts);
END;

-- Update trigger example
CREATE TRIGGER observations_au AFTER UPDATE ON observations BEGIN
 INSERT INTO observations_fts(observations_fts, rowid, title, subtitle, narrative, text, facts, concepts)
 VALUES('delete', old.id, old.title, old.subtitle, old.narrative, old.text, old.facts, old.concepts);
 INSERT INTO observations_fts(rowid, title, subtitle, narrative, text, facts, concepts)
 VALUES (new.id, new.title, new.subtitle, new.narrative, new.text, new.facts, new.concepts);
END;

-- Delete trigger example
CREATE TRIGGER observations_ad AFTER DELETE ON observations BEGIN
 INSERT INTO observations_fts(observations_fts, rowid, title, subtitle, narrative, text, facts, concepts)
 VALUES('delete', old.id, old.title, old.subtitle, old.narrative, old.text, old.facts, old.concepts);
END;

```