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); }