Merge pull request #1927 from deltachat/newacc-transaction

sql: create new accounts in one transaction
This commit is contained in:
bjoern
2020-09-19 13:22:28 +02:00
committed by GitHub

View File

@@ -716,8 +716,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);
@@ -902,6 +903,7 @@ CREATE TABLE devmsglabels (
CREATE INDEX devmsglabels_index1 ON devmsglabels (label);
"#,
)?;
tx.commit()?;
Ok(())
})
.await?;