mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-11-25 03:56:18 -05:00
set sqlite3 options for full durability
This commit is contained in:
@@ -97,6 +97,10 @@ pub fn run(args: &Args, conn: &mut rusqlite::Connection) -> Result<(), Error> {
|
||||
// be careful about the order of operations during the upgrade.
|
||||
conn.execute("pragma foreign_keys = on", &[] as &[&ToSql])?;
|
||||
|
||||
// Make the database actually durable.
|
||||
conn.execute("pragma fullfsync = on", &[] as &[&ToSql])?;
|
||||
conn.execute("pragma synchronous = 2", &[] as &[&ToSql])?;
|
||||
|
||||
// WAL is the preferred journal mode for normal operation; it reduces the number of syncs
|
||||
// without compromising safety.
|
||||
set_journal_mode(&conn, "wal").unwrap();
|
||||
|
||||
Reference in New Issue
Block a user