feat: final schema pass — sync 9 schema changes from main repo
- Rename nodes.content → nodes.notes across all services, tools, API routes, and UI - Add dimensions.icon column support (GET/POST routes, types) - Add nodes.event_date column (create/update flows, types) - Drop nodes.type and nodes.is_pinned references - Drop edges.user_feedback references - Drop chat_memory_state table (replaced with DROP IF EXISTS in migration) - Update schema guide files (system/schema.md) - Add runtime migration block in sqlite-client.ts for existing databases - Fix MCP tool schemas (external API keeps 'content' param, maps to 'notes' internally) - Update standalone MCP server (nodeService.js, sqlite-client.js, index.js) - Update HTTP MCP server (server.js, stdio-server.js) - Update all extraction tools (paper, website, youtube) - Update all UI components (FocusPanel, ThreePanelLayout, GridView, ListView, FolderViewOverlay) - TypeScript: 0 errors Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
1d323de11a
commit
86f43c9975
@@ -14,13 +14,12 @@ immutable: true
|
||||
| id | INTEGER | Primary key, auto-increment |
|
||||
| title | TEXT | Required |
|
||||
| description | TEXT | AI-generated grounding context (~1 sentence) |
|
||||
| content | TEXT | User's notes/thoughts (not source content) |
|
||||
| notes | TEXT | User's notes/thoughts (not source content) |
|
||||
| chunk | TEXT | Full verbatim source content |
|
||||
| chunk_status | TEXT | 'pending', 'chunked', 'failed' |
|
||||
| link | TEXT | External URL (only for nodes representing external content) |
|
||||
| type | TEXT | Nullable (reserved for future use) |
|
||||
| event_date | TEXT | When the content happened (ISO date) — distinct from created_at |
|
||||
| metadata | TEXT | JSON blob (map_position, transcript_length, etc.) |
|
||||
| is_pinned | INTEGER | Legacy — use hub node queries instead |
|
||||
| created_at | TEXT | ISO timestamp |
|
||||
| updated_at | TEXT | ISO timestamp |
|
||||
|
||||
@@ -38,29 +37,40 @@ immutable: true
|
||||
### dimensions
|
||||
| Column | Type | Notes |
|
||||
|--------|------|-------|
|
||||
| id | INTEGER | Primary key |
|
||||
| name | TEXT | Unique, case-insensitive |
|
||||
| name | TEXT | Primary key |
|
||||
| description | TEXT | Purpose description |
|
||||
| is_locked | INTEGER | 1 = priority dimension (auto-assigns to new nodes) |
|
||||
| icon | TEXT | Emoji or icon identifier for UI display |
|
||||
| is_priority | INTEGER | 1 = priority dimension (auto-assigns to new nodes) |
|
||||
| updated_at | TEXT | ISO timestamp |
|
||||
|
||||
### node_dimensions (junction)
|
||||
| Column | Type |
|
||||
|--------|------|
|
||||
| node_id | INTEGER FK → nodes.id |
|
||||
| dimension_id | INTEGER FK → dimensions.id |
|
||||
| dimension | TEXT (dimension name) |
|
||||
|
||||
### chunks (for semantic search)
|
||||
| Column | Type | Notes |
|
||||
|--------|------|-------|
|
||||
| id | INTEGER | Primary key |
|
||||
| node_id | INTEGER | FK → nodes.id |
|
||||
| chunk_index | INTEGER | Position in sequence |
|
||||
| chunk_idx | INTEGER | Position in sequence |
|
||||
| text | TEXT | Chunk content |
|
||||
| embedding | BLOB | Vector (via sqlite-vec) |
|
||||
| created_at | TEXT | ISO timestamp |
|
||||
| embedding_type | TEXT | Embedding model used |
|
||||
| metadata | TEXT | JSON blob |
|
||||
|
||||
### voice_usage (daily tracking)
|
||||
| Column | Type | Notes |
|
||||
|--------|------|-------|
|
||||
| id | INTEGER | Primary key |
|
||||
| date | TEXT | ISO date (UNIQUE) |
|
||||
| minutes_used | REAL | Minutes consumed |
|
||||
| updated_at | TEXT | ISO timestamp |
|
||||
|
||||
### FTS Tables
|
||||
- `chunks_fts` — full-text search on chunk text
|
||||
- `nodes_fts` — full-text search on node title + content
|
||||
- `nodes_fts` — full-text search on node title + notes
|
||||
|
||||
## Common Query Patterns
|
||||
|
||||
@@ -76,8 +86,7 @@ GROUP BY n.id ORDER BY edge_count DESC LIMIT 5
|
||||
```sql
|
||||
SELECT n.* FROM nodes n
|
||||
JOIN node_dimensions nd ON n.id = nd.node_id
|
||||
JOIN dimensions d ON nd.dimension_id = d.id
|
||||
WHERE d.name = ?
|
||||
WHERE nd.dimension = ?
|
||||
```
|
||||
|
||||
**Edges for a node (both directions):**
|
||||
@@ -89,4 +98,14 @@ JOIN nodes n2 ON e.to_node_id = n2.id
|
||||
WHERE e.from_node_id = ? OR e.to_node_id = ?
|
||||
```
|
||||
|
||||
**Use sqliteQuery for any read operation not covered by structured tools.**
|
||||
**Search source content (chunks):**
|
||||
```sql
|
||||
SELECT c.id, c.node_id, c.chunk_idx, c.text, n.title
|
||||
FROM chunks c
|
||||
JOIN nodes n ON c.node_id = n.id
|
||||
WHERE c.text LIKE '%search term%' COLLATE NOCASE
|
||||
ORDER BY c.chunk_idx ASC
|
||||
LIMIT 10
|
||||
```
|
||||
|
||||
**Use `rah_search_content` to search chunks by keyword, or `rah_sqlite_query` for any read operation not covered by structured tools.**
|
||||
|
||||
Reference in New Issue
Block a user