mirror of
https://github.com/scottlamb/moonfire-nvr.git
synced 2025-04-01 02:03:42 -04:00
check SQLite database integrity
This commit is contained in:
parent
cdd878f452
commit
972f26f30a
@ -50,6 +50,13 @@ pub struct Options {
|
|||||||
pub fn run(conn: &rusqlite::Connection, opts: &Options) -> Result<i32, Error> {
|
pub fn run(conn: &rusqlite::Connection, opts: &Options) -> Result<i32, Error> {
|
||||||
let mut printed_error = false;
|
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.
|
// Compare stated schema version.
|
||||||
if let Err(e) = db::check_schema_version(conn) {
|
if let Err(e) = db::check_schema_version(conn) {
|
||||||
error!("Schema version is not as expected:\n{}", e);
|
error!("Schema version is not as expected:\n{}", e);
|
||||||
@ -66,9 +73,8 @@ pub fn run(conn: &rusqlite::Connection, opts: &Options) -> Result<i32, Error> {
|
|||||||
error!("Schema is not as expected:\n{}", &diffs);
|
error!("Schema is not as expected:\n{}", &diffs);
|
||||||
printed_error = true;
|
printed_error = true;
|
||||||
} else {
|
} else {
|
||||||
println!("Schema is as expected.");
|
info!("Schema is as expected.");
|
||||||
}
|
}
|
||||||
info!("Done comparing schemas.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if printed_error {
|
if printed_error {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user