Skip to content

Database schema ​

Each workspace has one SQLite database, altar.db, next to its assets/ and backups/ folders. See Workspace folder.

Connection ​

  • One connection behind a mutex. All access goes through Workspace::with(|conn| …) in db.rs.
  • Pragmas: journal_mode = WAL, foreign_keys = ON, synchronous = NORMAL.
  • Only one copy of Altar Studio runs at a time (the single-instance plugin), so only one process writes to a workspace.

Migrations ​

Migrations are SQL strings in the MIGRATIONS array in db.rs, numbered by PRAGMA user_version. There is currently one: v1, the initial schema.

  • Pending migrations run in one transaction, setting user_version after each.
  • Before migrating an existing database, the backend copies it to backups/pre-migration-v<N>-<timestamp>.db with VACUUM INTO.
  • To change the schema, append a new migration. Never edit an existing one.

Tables ​

resources ​

Library content: songs, presentations (prayers, The Word, slides), themes, breakers, lower thirds, feeds and PowerPoint decks.

ColumnTypeNotes
idTEXT PKUUID
kindTEXTsong, presentation, theme, breaker, lowerthird, feed, deck
titleTEXT
subtitleTEXT
search_textTEXTText indexed for search
dataTEXTJSON payload for the kind
revisionINTEGERDefault 1, bumped on each save
archivedINTEGER0 or 1 (soft delete)
created_at, updated_atINTEGEREpoch ms

Index resources_kind (kind, archived, title COLLATE NOCASE).

resources_fts ​

FTS5 index over title and search_text. External content (content='resources'), tokenizer unicode61 remove_diacritics 2, prefix indexes for 2 and 3 characters. The triggers resources_ai, resources_ad and resources_au keep it in sync.

services ​

ColumnTypeNotes
idTEXT PK
nameTEXTRequired
service_dateTEXTNullable
notesTEXT
dataTEXTJSON {items: ScheduleNode[]}
revisionINTEGERBumped on save, not checked
created_at, updated_atINTEGER

assets ​

ColumnTypeNotes
hashTEXT PKSHA-256, hex
nameTEXTFirst name it was imported under
ext, kind, mimeTEXT
sizeINTEGERBytes
rel_pathTEXTassets/<first two hex chars>/<hash>.<ext>
metaTEXTJSON, default {}
archivedINTEGER
created_atINTEGER

bible_packs ​

id (PK), name, abbreviation, language, version, rights (JSON), structure (JSON: books and verse counts per chapter), installed_at.

verses ​

Primary key (translation_id, book, chapter, verse), plus text. translation_id references bible_packs(id) with ON DELETE CASCADE. WITHOUT ROWID.

verses_fts_map and verses_fts ​

verses_fts is a standalone FTS5 table over verse text (unicode61 remove_diacritics 2). verses_fts_map maps each FTS row ID back to (translation_id, book, chapter, verse), with an index on translation_id.

settings ​

key (TEXT PK), value (TEXT, JSON).

KeyContents
appAppSettings: everything on the Settings page, including the church profile
firstRunCompletetrue after the first-run wizard
lastServiceIdThe service to reopen at launch
sampleInstalledWhether sample content was installed
scripture-historyUp to 200 passages sent live

history ​

The presentation log: id (autoincrement), at, service_id, command, scene_revision, result. It's trimmed to about the newest 20 000 rows.

Commands written: go-live, go-live:transition (result queued), transition-complete, mode:content, mode:black, mode:logo.

Search queries ​

library::fts_query splits the query on characters that aren't letters or digits (apostrophes are kept), quotes each word, adds * for prefix matching, and joins them, so every word must match. bible_search uses the same function.

Altar Studio by Milton Black. Free and open source.