module
Memo::Database
Overview
Database initialization and schema management
Memo can operate in two modes:
- Shared database: Uses table_prefix (default "memo_") to avoid conflicts
- Standalone database: No prefix needed, tables named: services, embeddings, chunks, embed_queue
Extended Modules
Defined in:
memo/database.crInstance Method Summary
-
#create(path : String) : DB::Database
Create new database file and initialize schema (standalone mode)
-
#init(db : DB::Database)
Initialize Memo schema in provided database (standalone mode)
-
#init_text_db(db : DB::Database, schema_name : String = "text_store")
Initialize text storage database schema
-
#load_schema(db : DB::Database)
Load memo schema into the provided database (shared mode)
Instance Method Detail
Create new database file and initialize schema (standalone mode)
Creates a new SQLite database at the specified path and loads Memo schema. Returns the database connection.
Initialize Memo schema in provided database (standalone mode)
Loads consolidated schema without table prefixes. Use when Memo has its own dedicated database file. Safe to call multiple times (uses IF NOT EXISTS)
Initialize text storage database schema
Creates the texts table for storing document content. Text is keyed by content hash (same as embeddings). This database is persistent and survives embedding regeneration.
Also creates FTS5 virtual table for full-text search.
Load memo schema into the provided database (shared mode)
Creates tables with configured prefix: memo_embeddings, memo_chunks, memo_embed_queue Use when Memo shares database with application tables. Safe to call multiple times (uses IF NOT EXISTS)