File tree 2 files changed +12
-12
lines changed
2 files changed +12
-12
lines changed Original file line number Diff line number Diff line change @@ -219,23 +219,23 @@ pub struct Database {
219
219
#[ serde( default ) ]
220
220
pub dangerously_recreate : bool ,
221
221
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.
224
224
/// Default values are:
225
225
///
226
- /// PRAGMA foreign_keys = ON;
226
+ /// PRAGMA ` foreign_keys` = ON;
227
227
///
228
- /// PRAGMA journal_mode = WAL;
228
+ /// PRAGMA ` journal_mode` = WAL;
229
229
///
230
- /// PRAGMA synchronous = NORMAL;
230
+ /// PRAGMA ` synchronous` = NORMAL;
231
231
///
232
- /// PRAGMA mmap_size = 134217728;
232
+ /// PRAGMA ` mmap_size` = 134217728;
233
233
///
234
- /// PRAGMA journal_size_limit = 67108864;
234
+ /// PRAGMA ` journal_size_limit` = 67108864;
235
235
///
236
- /// PRAGMA cache_size = 2000;
236
+ /// PRAGMA ` cache_size` = 2000;
237
237
///
238
- /// PRAGMA busy_timeout = 5000;
238
+ /// PRAGMA ` busy_timeout` = 5000;
239
239
pub run_on_start : Option < String > ,
240
240
}
241
241
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ pub async fn connect(config: &config::Database) -> Result<DbConn, sea_orm::DbErr
152
152
if db. get_database_backend ( ) == DatabaseBackend :: Sqlite {
153
153
db. execute ( Statement :: from_string (
154
154
DatabaseBackend :: Sqlite ,
155
- config. run_on_start . clone ( ) . unwrap_or (
155
+ config. run_on_start . clone ( ) . unwrap_or_else ( || {
156
156
"
157
157
PRAGMA foreign_keys = ON;
158
158
PRAGMA journal_mode = WAL;
@@ -162,8 +162,8 @@ pub async fn connect(config: &config::Database) -> Result<DbConn, sea_orm::DbErr
162
162
PRAGMA cache_size = 2000;
163
163
PRAGMA busy_timeout = 5000;
164
164
"
165
- . to_string ( ) ,
166
- ) ,
165
+ . to_string ( )
166
+ } ) ,
167
167
) )
168
168
. await ?;
169
169
}
You can’t perform that action at this time.
0 commit comments