Skip to content

Commit 6ebc685

Browse files
committed
fix: docstring
1 parent 328d133 commit 6ebc685

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/config.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -219,23 +219,23 @@ pub struct Database {
219219
#[serde(default)]
220220
pub dangerously_recreate: bool,
221221

222-
// sqlite run on start commands
223-
/// this can be used to confiure PRAGMAs for SQLite where you can pass all values as a string.
222+
// Execute query after initializing the DB
223+
/// for e.g. this can be used to confiure PRAGMAs for `SQLite` where you can pass all values as a string.
224224
/// Default values are:
225225
///
226-
/// PRAGMA foreign_keys = ON;
226+
/// PRAGMA `foreign_keys` = ON;
227227
///
228-
/// PRAGMA journal_mode = WAL;
228+
/// PRAGMA `journal_mode` = WAL;
229229
///
230-
/// PRAGMA synchronous = NORMAL;
230+
/// PRAGMA `synchronous` = NORMAL;
231231
///
232-
/// PRAGMA mmap_size = 134217728;
232+
/// PRAGMA `mmap_size` = 134217728;
233233
///
234-
/// PRAGMA journal_size_limit = 67108864;
234+
/// PRAGMA `journal_size_limit` = 67108864;
235235
///
236-
/// PRAGMA cache_size = 2000;
236+
/// PRAGMA `cache_size` = 2000;
237237
///
238-
/// PRAGMA busy_timeout = 5000;
238+
/// PRAGMA `busy_timeout` = 5000;
239239
pub run_on_start: Option<String>,
240240
}
241241

src/db.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ pub async fn connect(config: &config::Database) -> Result<DbConn, sea_orm::DbErr
152152
if db.get_database_backend() == DatabaseBackend::Sqlite {
153153
db.execute(Statement::from_string(
154154
DatabaseBackend::Sqlite,
155-
config.run_on_start.clone().unwrap_or(
155+
config.run_on_start.clone().unwrap_or_else(|| {
156156
"
157157
PRAGMA foreign_keys = ON;
158158
PRAGMA journal_mode = WAL;
@@ -162,8 +162,8 @@ pub async fn connect(config: &config::Database) -> Result<DbConn, sea_orm::DbErr
162162
PRAGMA cache_size = 2000;
163163
PRAGMA busy_timeout = 5000;
164164
"
165-
.to_string(),
166-
),
165+
.to_string()
166+
}),
167167
))
168168
.await?;
169169
}

0 commit comments

Comments
 (0)