Initial commit: OpenFUT Core
Offline Ultimate Team backend — game-independent REST API. - 19 API endpoints: auth, profiles, clubs, cards, packs, squads, objectives, SBCs, match rewards, NPC market, statistics - Axum + SQLite + SQLx with full migrations - Weighted pack generator, SBC validation engine - JSON-driven mod data (cards, packs, objectives, SBCs) - 5 integration tests passing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
use anyhow::Result;
|
||||
use sqlx::{sqlite::SqlitePoolOptions, SqlitePool};
|
||||
use tracing::info;
|
||||
|
||||
pub type Pool = SqlitePool;
|
||||
|
||||
pub async fn init_pool(database_url: &str) -> Result<Pool> {
|
||||
info!("Connecting to database: {}", database_url);
|
||||
let pool = SqlitePoolOptions::new()
|
||||
.max_connections(5)
|
||||
.connect(database_url)
|
||||
.await?;
|
||||
Ok(pool)
|
||||
}
|
||||
|
||||
pub async fn run_migrations(pool: &Pool) -> Result<()> {
|
||||
info!("Running database migrations");
|
||||
sqlx::migrate!("./migrations").run(pool).await?;
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user