diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-03-21 19:48:57 +0100 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2025-03-21 19:48:57 +0100 |
commit | d1f004ce48caf90ab4f3ec1d0bbb588c9cbf0fe9 (patch) | |
tree | 62e903ff1697df4ae7f639484c239d8c325866b2 | |
parent | style(treewide): Adopt rust edition 2024 rustfmt style (diff) | |
download | yt-d1f004ce48caf90ab4f3ec1d0bbb588c9cbf0fe9.zip |
fix(yt/storage/migrate): Account for the fact that DbVersions::Empty means no Version
Diffstat (limited to '')
-rw-r--r-- | yt/src/storage/migrate/mod.rs | 15 |
1 files 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 |