From 0e45ab5aa9820f618f39ae27969b2f11abe3c874 Mon Sep 17 00:00:00 2001 From: Alex Mikhalev Date: Thu, 1 Oct 2020 14:24:37 -0600 Subject: [PATCH] Use SQLITE write-ahead logging --- .gitignore | 11 +++++++++-- sprinklers_database/src/lib.rs | 3 +++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 8d335a9..407522a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,11 @@ +# Cargo/Rust /target -/.vscode +Cargo.lock + +# Visual studio code +.vscode + +# Sqlite databases /*.db -Cargo.lock \ No newline at end of file +*.db-shm +*.db-wal \ No newline at end of file diff --git a/sprinklers_database/src/lib.rs b/sprinklers_database/src/lib.rs index 671fc6f..974e2c0 100644 --- a/sprinklers_database/src/lib.rs +++ b/sprinklers_database/src/lib.rs @@ -17,6 +17,9 @@ pub fn setup_db() -> Result { // let conn = DbConn::open_in_memory()?; let mut conn = DbConn::open("test.db")?; + // Go ahead and use write ahead log for better perf + conn.execute_batch("PRAGMA journal_mode=WAL;")?; + let migs = create_migrations(); migs.apply(&mut conn)?;