Skip to main content

systemprompt_runtime/
installation.rs

1use anyhow::Result;
2use systemprompt_database::{
3    install_module_schemas_from_source, install_module_seeds_from_path, DatabaseProvider,
4};
5use systemprompt_models::modules::Module;
6
7use crate::AppContext;
8
9pub async fn install_module(module: &Module) -> Result<()> {
10    let app_context = AppContext::new().await?;
11    install_module_with_db(module, app_context.db_pool().as_ref()).await
12}
13
14pub async fn install_module_with_db(module: &Module, db: &dyn DatabaseProvider) -> Result<()> {
15    install_module_schemas_from_source(module, db).await?;
16    install_module_seeds_from_path(module, db).await?;
17    Ok(())
18}