repo/sqlite: don't update tas info without changes

This commit is contained in:
Dmitriy Pleshevskiy 2022-08-20 15:54:17 +03:00
parent eb78dad91a
commit 862b3218e5
Signed by: pleshevskiy
GPG key ID: 1B59187B161C0215

View file

@ -251,7 +251,7 @@ impl SqliteRepo {
} }
macro_rules! run_migration { macro_rules! run_migration {
($this:ident, $ver:ident = $version:expr) => { ($this:ident, $ver:ident = $version:literal) => {
$this $this
.conn .conn
.execute_batch(&format!( .execute_batch(&format!(
@ -288,9 +288,15 @@ impl std::fmt::Display for MigrationError {
impl std::error::Error for MigrationError {} impl std::error::Error for MigrationError {}
const LATEST_VERSION: i64 = 202208162308;
impl SqliteRepo { impl SqliteRepo {
pub fn upgrade(&self) -> Result<(), MigrationError> { pub fn upgrade(&self) -> Result<(), MigrationError> {
let mut version = self.version(); let mut version = self.version();
if version == Some(LATEST_VERSION) {
return Ok(());
}
if version.is_none() { if version.is_none() {
run_migration!(self, version = 202208162308); run_migration!(self, version = 202208162308);
} }