mirror of
https://github.com/chatmail/core.git
synced 2026-04-02 05:22:14 +03:00
sql: create new accounts in one transaction
This prevents SQLite from synchronizing to disk after each statement, saving time on high latency HDDs.
This commit is contained in:
@@ -713,8 +713,9 @@ async fn open(
|
||||
"First time init: creating tables in {:?}.",
|
||||
dbfile.as_ref(),
|
||||
);
|
||||
sql.with_conn(move |conn| {
|
||||
conn.execute_batch(
|
||||
sql.with_conn(move |mut conn| {
|
||||
let tx = conn.transaction()?;
|
||||
tx.execute_batch(
|
||||
r#"
|
||||
CREATE TABLE config (id INTEGER PRIMARY KEY, keyname TEXT, value TEXT);
|
||||
CREATE INDEX config_index1 ON config (keyname);
|
||||
@@ -899,6 +900,7 @@ CREATE TABLE devmsglabels (
|
||||
CREATE INDEX devmsglabels_index1 ON devmsglabels (label);
|
||||
"#,
|
||||
)?;
|
||||
tx.commit()?;
|
||||
Ok(())
|
||||
})
|
||||
.await?;
|
||||
|
||||
Reference in New Issue
Block a user