Skip to main content

Module db

Module db 

Source
Expand description

Opens the CLI’s database, seeds the built-in and user-catalog DCS/PLC templates, and runs the history-retention sweep – all on every startup.

Functions§

open
Opens (creating if necessary) the database at path, running migrations, then upserts the built-in templates via bhtune_db::seed_builtin_templates so a fresh database is immediately usable without a separate setup step. If user_templates is Some (the caller found and parsed a user catalog file – see crate::config::load_user_templates, template-user-catalog), those templates are additionally upserted with TemplateOrigin::Catalog via bhtune_db::seed_templates. None means no user catalog file was found at all, which is not an error and simply skips this second seed pass – the common case, since most installs never create templates.toml.