about summary refs log tree commit diff stats
path: root/yt/src/storage/migrate
diff options
context:
space:
mode:
Diffstat (limited to 'yt/src/storage/migrate')
-rw-r--r--yt/src/storage/migrate/mod.rs15
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