Serveur Rust : socle (config, base, auth, sessions, journaux, cache FF, SPA)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LG2LLJuswrrTTPKJmunEVf
This commit is contained in:
Claude committed 2026-10-12 18:56:23 +00:00
1 parent d2c3dc7f8e
commit 3f69b1904e
28 files changed
+5873

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
//! Schéma de la base, joué à chaque démarrage (idempotent).
const INIT_SQL: &str = include_str!("../sql/init.sql");
pub async fn run() {
tracing::info!("[DB Init] Starting database migration & initialization...");
let pool = match crate::db::pool() {
Ok(p) => p,
Err(_) => {
tracing::warn!("[DB Init] No DATABASE_URL found in env or config. Skipping.");
return;
}
};
match sqlx::raw_sql(INIT_SQL).execute(&pool).await {
Ok(_) => tracing::info!("[DB Init] Initialization successful."),
// L'application reste utilisable (comptes de secours, Paramètres).
Err(e) => tracing::error!("[DB Init] Initialization failed: {e}"),
}
}