mirror of
https://github.com/R0m1k3/CollectFlow.git
synced 2026-10-19 21:18:16 +02:00
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:
28 files changed
+5873
No files matched your search
@@ -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}"),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user