Browse Source

Use SQLITE write-ahead logging

master
Alex Mikhalev 4 years ago
parent
commit
0e45ab5aa9
  1. 11
      .gitignore
  2. 3
      sprinklers_database/src/lib.rs

11
.gitignore vendored

@ -1,4 +1,11 @@ @@ -1,4 +1,11 @@
# Cargo/Rust
/target
/.vscode
Cargo.lock
# Visual studio code
.vscode
# Sqlite databases
/*.db
Cargo.lock
*.db-shm
*.db-wal

3
sprinklers_database/src/lib.rs

@ -17,6 +17,9 @@ pub fn setup_db() -> Result<DbConn> { @@ -17,6 +17,9 @@ pub fn setup_db() -> Result<DbConn> {
// 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)?;

Loading…
Cancel
Save