big features

This commit is contained in:
Mateusz Gruszczyński
2026-07-22 11:03:50 +02:00
parent 0d77624adc
commit 1be2023e36
30 changed files with 1077 additions and 77 deletions
+4 -3
View File
@@ -1,3 +1,4 @@
use crate::queries;
use sqlx::{any::AnyPoolOptions, AnyPool};
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -22,9 +23,9 @@ impl Database {
.connect(url)
.await?;
if kind == DatabaseKind::Sqlite {
sqlx::query("PRAGMA foreign_keys = ON").execute(&pool).await?;
sqlx::query("PRAGMA journal_mode = WAL").execute(&pool).await?;
sqlx::query("PRAGMA busy_timeout = 5000").execute(&pool).await?;
sqlx::query(queries::SQLITE_FOREIGN_KEYS_ON).execute(&pool).await?;
sqlx::query(queries::SQLITE_JOURNAL_WAL).execute(&pool).await?;
sqlx::query(queries::SQLITE_BUSY_TIMEOUT).execute(&pool).await?;
}
Ok(Self { pool, kind })
}