From 132ad3adf8445785c2fa5401a5bf66ca47bd49ba Mon Sep 17 00:00:00 2001 From: Dmitriy Pleshevskiy Date: Sat, 20 Aug 2022 15:53:24 +0300 Subject: [PATCH] repo/sqlite: don't update tas info without changes --- src/repo/sqlite.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/repo/sqlite.rs b/src/repo/sqlite.rs index ba299f1..0a06f6a 100644 --- a/src/repo/sqlite.rs +++ b/src/repo/sqlite.rs @@ -251,7 +251,7 @@ impl SqliteRepo { } macro_rules! run_migration { - ($this:ident, $ver:ident = $version:expr) => { + ($this:ident, $ver:ident = $version:literal) => { $this .conn .execute_batch(&format!( @@ -288,9 +288,15 @@ impl std::fmt::Display for MigrationError { impl std::error::Error for MigrationError {} +const LATEST_VERSION: i64 = 202208162308; + impl SqliteRepo { pub fn upgrade(&self) -> Result<(), MigrationError> { let mut version = self.version(); + if version == Some(LATEST_VERSION) { + return Ok(()); + } + if version.is_none() { run_migration!(self, version = 202208162308); }