From 972f26f30a3104b15f0f599512e8251c4d271ea0 Mon Sep 17 00:00:00 2001 From: Scott Lamb Date: Thu, 11 Feb 2021 15:24:24 -0800 Subject: [PATCH] check SQLite database integrity --- server/db/check.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/server/db/check.rs b/server/db/check.rs index 932b512..f3898d2 100644 --- a/server/db/check.rs +++ b/server/db/check.rs @@ -50,6 +50,13 @@ pub struct Options { pub fn run(conn: &rusqlite::Connection, opts: &Options) -> Result { let mut printed_error = false; + info!("Checking SQLite database integrity..."); + if let Err(e) = conn.execute("pragma check_integrity", params![]) { + error!("Database integrity error: {}", e); + printed_error = true; + } + info!("...done"); + // Compare stated schema version. if let Err(e) = db::check_schema_version(conn) { error!("Schema version is not as expected:\n{}", e); @@ -66,9 +73,8 @@ pub fn run(conn: &rusqlite::Connection, opts: &Options) -> Result { error!("Schema is not as expected:\n{}", &diffs); printed_error = true; } else { - println!("Schema is as expected."); + info!("Schema is as expected."); } - info!("Done comparing schemas."); } if printed_error {