module Memo::Database

Overview

Database initialization and schema management

Memo can operate in two modes:

  1. Standalone: Memo has its own memo.db file, no table prefix needed
  2. Embedded: Tables in app's database with prefix (default "memo_")

Extended Modules

Defined in:

memo/database.cr

Instance Method Summary

Instance Method Detail

def create(path : String) : DB::Database #

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.


[View source]
def init(db : DB::Database) #

Initialize Memo schema in provided database

Loads consolidated schema with table prefix applied. Safe to call multiple times (uses IF NOT EXISTS)


[View source]
def load_schema(db : DB::Database) #

Load memo schema into the provided database (embedded mode)

Creates tables with configured prefix (e.g., memo_embeddings, memo_chunks) Use when Memo shares database with application tables. Safe to call multiple times (uses IF NOT EXISTS)


[View source]