From d1f004ce48caf90ab4f3ec1d0bbb588c9cbf0fe9 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Fri, 21 Mar 2025 19:48:57 +0100 Subject: fix(yt/storage/migrate): Account for the fact that DbVersions::Empty means no Version --- yt/src/storage/migrate/mod.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/yt/src/storage/migrate/mod.rs b/yt/src/storage/migrate/mod.rs index 122170c..d320b62 100644 --- a/yt/src/storage/migrate/mod.rs +++ b/yt/src/storage/migrate/mod.rs @@ -37,9 +37,18 @@ macro_rules! make_upgrade { .await .context("Failed to run the update sql script")?; - set_db_version(&mut tx, Some($old_version), $new_version) - .await - .context("Failed to set the new version")?; + set_db_version( + &mut tx, + if $old_version == Self::Empty { + // There is no previous version we would need to remove + None + } else { + Some($old_version) + }, + $new_version, + ) + .await + .context("Failed to set the new version")?; tx.commit() .await -- cgit 1.4.1