refact: migrate sqlx + sqlite to tokio-postgresql

This commit is contained in:
Henri Bourcereau 2026-04-22 21:36:56 +02:00
parent 4f5e21becb
commit 03b614c62e
12 changed files with 838 additions and 250 deletions

View file

@ -6,7 +6,7 @@
use bytes::Bytes;
use serde::{Deserialize, Serialize};
use sqlx::SqlitePool;
use deadpool_postgres::Pool;
use std::collections::HashMap;
use std::sync::Arc;
use tokio::fs;
@ -57,12 +57,12 @@ pub struct AppState {
pub rooms: Mutex<HashMap<String, Room>>,
/// Contains a mapping from game name to the maximum amount of players allowed.
pub configs: RwLock<HashMap<String, u16>>,
/// SQLite connection pool — shared across all request handlers.
pub db: SqlitePool,
/// PostgreSQL connection pool — shared across all request handlers.
pub db: Pool,
}
impl AppState {
pub fn new(db: SqlitePool) -> Self {
pub fn new(db: Pool) -> Self {
Self {
rooms: Mutex::new(HashMap::new()),
configs: RwLock::new(HashMap::new()),