Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stop quitting when version downgrade #608

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions mithril-common/src/database/db_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::{cmp::Ordering, collections::HashMap, error::Error, fmt::Display, path:

use chrono::{Local, NaiveDateTime};
use semver::Version;
use slog::{debug, error, warn, Logger};
use slog::{debug, warn, Logger};
use sqlite::{Connection, Row, Value};

use crate::sqlite::{HydrationError, Projection, ProjectionField, Provider, SqLiteEntity};
Expand Down Expand Up @@ -298,14 +298,12 @@ impl ApplicationVersionChecker {
debug!(&self.logger, "database updated");
}
Ordering::Less => {
error!(
warn!(
&self.logger,
"Software version '{}' is older than database structure version '{}'.",
current_version.semver,
version.semver
);

Err("This software version is older than the database structure. Aborting launch to prevent possible data corruption.")?;
}
Ordering::Equal => {
debug!(&self.logger, "database up to date");
Expand Down Expand Up @@ -393,6 +391,6 @@ returning app_version.semver as semver, app_version.application_type as applicat
check_database_version(&filepath, "1.0.0");
app_checker.check("1.1.0").unwrap();
check_database_version(&filepath, "1.1.0");
app_checker.check("1.0.1").unwrap_err();
app_checker.check("1.0.1").unwrap();
}
}