Add backend

This commit is contained in:
Jon Staab
2026-02-25 13:11:25 -08:00
parent d2ade19763
commit 42abde9dcd
11 changed files with 1104 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
use anyhow::Result;
use sqlx::{migrate::Migrator, sqlite::SqlitePoolOptions, SqlitePool};
static MIGRATOR: Migrator = sqlx::migrate!("./migrations");
pub async fn init_pool(database_url: &str) -> Result<SqlitePool> {
let pool = SqlitePoolOptions::new()
.max_connections(5)
.connect(database_url)
.await?;
MIGRATOR.run(&pool).await?;
Ok(pool)
}