big features
This commit is contained in:
+4
-3
@@ -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 })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user