feat: Implement external MySQL integration for LMS enrollments and grade synchronization, including external_id and tipo_nota support.

This commit is contained in:
2026-02-27 09:20:35 -03:00
parent e5373919c9
commit bbef932776
13 changed files with 485 additions and 5 deletions
+26
View File
@@ -0,0 +1,26 @@
use sqlx::{MySql, Pool};
use std::env;
pub type MySqlPool = Pool<MySql>;
pub async fn init_mysql_pool() -> Option<MySqlPool> {
if let Ok(url) = env::var("MYSQL_DATABASE_URL") {
match sqlx::mysql::MySqlPoolOptions::new()
.max_connections(5)
.connect(&url)
.await
{
Ok(pool) => {
tracing::info!("Connected to external MySQL database");
Some(pool)
}
Err(e) => {
tracing::error!("Failed to connect to external MySQL database: {}", e);
None
}
}
} else {
tracing::info!("MYSQL_DATABASE_URL not set, skipping external database integration");
None
}
}