Fix bugs and add controller action for controller ws

This commit is contained in:
Tobias Reisinger 2023-12-05 16:11:40 +01:00
parent 8b1affd8c7
commit 6f8d63e7be
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE
11 changed files with 177 additions and 56 deletions
emgauwa-lib/src/db

View file

@ -2,7 +2,7 @@ use std::str::FromStr;
use sqlx::migrate::Migrator;
use sqlx::sqlite::{SqliteConnectOptions, SqlitePoolOptions};
use sqlx::{Pool, Sqlite};
use sqlx::{ConnectOptions, Pool, Sqlite};
mod controllers;
mod junction_relay_schedule;
@ -30,7 +30,9 @@ pub async fn run_migrations(pool: &Pool<Sqlite>) -> Result<(), EmgauwaError> {
}
pub async fn init(db: &str) -> Result<Pool<Sqlite>, EmgauwaError> {
let options = SqliteConnectOptions::from_str(db)?.create_if_missing(true);
let options = SqliteConnectOptions::from_str(db)?
.create_if_missing(true)
.log_statements(log::LevelFilter::Trace);
let pool: Pool<Sqlite> = SqlitePoolOptions::new()
.acquire_timeout(std::time::Duration::from_secs(1))