updated 2026-11-26·5 min read
Database Schema Reference
Canonical SQLite relational schema (.noether/noether.sqlite) covering documents, blocks, document_links, document_tags, blocks_fts, trash_items, file_manifest, and extension tables.
Noether runs an embedded Rust SQLite engine (.noether/noether.sqlite via rusqlite) as a disposable query cache alongside your .md files on disk. Below is the canonical schema for core tables, indexes, blocks_fts, and extension-registered tables.
1. Architectural Role of SQLite
In Noether’s Dual-Storage Architecture, the physical CommonMark files on your storage drive are the primary source of truth. The SQLite database is an embedded metadata cache:
- Fast Graph Traversal: Bidirectional wikilink resolution across thousands of notes executes with indexed SQL joins instead of recursive disk scans.
- Hierarchical Taxonomies: Tags and folder trees are indexed for instant search and filtering.
- FTS5 Full-Text Search: Note bodies are tokenized into an SQLite FTS5 virtual table (
blocks_fts) for instant BM25-ranked searches without scanning files. - Disposability: If the database file is ever deleted, Noether scans the Vault’s markdown files and reconstructs the entire database automatically.
2. Core Relational Tables
Expand each table below to view its SQL schema, primary keys, and index definitions:
Table: documents (File Tree & Metadata)
Stores metadata, frontmatter properties, and tree hierarchy for all files and folders in the Vault:
CREATE TABLE IF NOT EXISTS documents (
id TEXT PRIMARY KEY,
parent_id TEXT,
title TEXT NOT NULL DEFAULT 'Untitled',
content_json TEXT NOT NULL DEFAULT '{}',
is_daily_note INTEGER NOT NULL DEFAULT 0,
is_folder INTEGER NOT NULL DEFAULT 0,
is_bookmarked INTEGER NOT NULL DEFAULT 0,
doc_type TEXT NOT NULL DEFAULT 'base',
properties TEXT DEFAULT '{}',
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_docs_parent_id ON documents(parent_id);
CREATE INDEX IF NOT EXISTS idx_docs_title ON documents(title);
CREATE INDEX IF NOT EXISTS idx_docs_is_folder ON documents(is_folder);Table: blocks (Granular Content Blocks & Tasks)
Represents individual content blocks within notes (paragraphs, code blocks, task list items) for granular queries:
CREATE TABLE IF NOT EXISTS blocks (
id TEXT PRIMARY KEY,
document_id TEXT NOT NULL,
parent_block_id TEXT,
content_text TEXT NOT NULL,
block_type TEXT NOT NULL DEFAULT 'paragraph',
order_index REAL NOT NULL,
is_task INTEGER NOT NULL DEFAULT 0,
task_completed INTEGER NOT NULL DEFAULT 0
);
CREATE INDEX IF NOT EXISTS idx_blocks_document_id ON blocks(document_id);
CREATE INDEX IF NOT EXISTS idx_blocks_doc_order ON blocks(document_id, order_index);
CREATE INDEX IF NOT EXISTS idx_blocks_is_task ON blocks(is_task, task_completed);Table: document_links (Bidirectional Wikilink Graph)
Indexes all forward links and backlinks generated by [[Wikilinks]] in note content:
CREATE TABLE IF NOT EXISTS document_links (
source_document_id TEXT NOT NULL,
target_document_id TEXT NOT NULL,
link_text TEXT,
PRIMARY KEY (source_document_id, target_document_id)
);
CREATE INDEX IF NOT EXISTS idx_doc_links_target ON document_links(target_document_id);Table: document_tags (Tag Taxonomy)
Stores tag associations extracted from note bodies (#tag) and frontmatter arrays:
CREATE TABLE IF NOT EXISTS document_tags (
document_id TEXT NOT NULL,
tag TEXT NOT NULL,
PRIMARY KEY (document_id, tag)
);
CREATE INDEX IF NOT EXISTS idx_doc_tags_tag ON document_tags(tag);Virtual Table: blocks_fts (FTS5 Full-Text Search)
Enables fast BM25 ranking across note content blocks with diacritic normalization:
CREATE VIRTUAL TABLE IF NOT EXISTS blocks_fts USING fts5(
block_id UNINDEXED,
document_id UNINDEXED,
content_text,
tokenize = 'unicode61 remove_diacritics 1'
);Table: trash_items (Soft-Deleted Note Archive)
Maintains soft-deleted documents and folder structures before permanent purge:
CREATE TABLE IF NOT EXISTS trash_items (
id TEXT PRIMARY KEY,
original_id TEXT NOT NULL,
parent_id TEXT,
title TEXT NOT NULL,
content_json TEXT NOT NULL DEFAULT '{}',
is_daily_note INTEGER NOT NULL DEFAULT 0,
is_folder INTEGER NOT NULL DEFAULT 0,
is_bookmarked INTEGER NOT NULL DEFAULT 0,
doc_type TEXT NOT NULL DEFAULT 'base',
properties TEXT DEFAULT '{}',
deleted_at INTEGER NOT NULL,
original_path TEXT
);
CREATE INDEX IF NOT EXISTS idx_trash_deleted_at ON trash_items(deleted_at);Table: file_manifest (Filesystem Diff Accelerator)
Tracks on-disk file timestamps and hashes to accelerate startup indexing diffs:
CREATE TABLE IF NOT EXISTS file_manifest (
relative_path TEXT PRIMARY KEY,
mtime INTEGER NOT NULL,
size INTEGER NOT NULL,
content_hash TEXT NOT NULL,
indexed_at INTEGER NOT NULL
);
CREATE INDEX IF NOT EXISTS idx_manifest_mtime ON file_manifest(mtime);Table: noether_meta (Schema Metadata)
Stores vault database metadata key-value pairs such as schema versioning:
CREATE TABLE IF NOT EXISTS noether_meta (
key TEXT PRIMARY KEY,
value TEXT
);Table: noether_extension_tables (Extension Table Registry)
Tracks relational database tables declared dynamically by extensions:
CREATE TABLE IF NOT EXISTS noether_extension_tables (
extension_id TEXT NOT NULL,
table_name TEXT NOT NULL,
physical_table_name TEXT NOT NULL,
version INTEGER NOT NULL DEFAULT 1,
teardown_policy TEXT NOT NULL DEFAULT 'drop-on-uninstall',
created_at INTEGER NOT NULL,
updated_at INTEGER NOT NULL,
PRIMARY KEY (extension_id, table_name)
);3. Storage Engine Implementation
Noether runs on a native compiled SQLite engine (rusqlite) communicating directly with the Tauri host:
- Uses native C/Rust SQLite compiled directly into the Tauri binary.
- Configured with
PRAGMA journal_mode = WAL;(Write-Ahead Logging),PRAGMA synchronous = NORMAL;, and 256MB memory-mapped I/O (PRAGMA mmap_size = 268435456;). - Eliminates the memory footprint and slow binary dumps of WebAssembly runtimes.
- Page commits run on background worker threads so typing in the UI thread never drops frames.