diff options
Diffstat (limited to 'crates/yt/src/storage/migrate/mod.rs')
-rw-r--r-- | crates/yt/src/storage/migrate/mod.rs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/crates/yt/src/storage/migrate/mod.rs b/crates/yt/src/storage/migrate/mod.rs index 4fa39ab..e2d93bd 100644 --- a/crates/yt/src/storage/migrate/mod.rs +++ b/crates/yt/src/storage/migrate/mod.rs @@ -91,8 +91,11 @@ pub(crate) enum DbVersion { /// Introduced: 2025-03-21. Three, + + /// Introduced: 2025-07-05. + Four, } -const CURRENT_VERSION: DbVersion = DbVersion::Three; +const CURRENT_VERSION: DbVersion = DbVersion::Four; async fn add_error_context( function: impl Future<Output = Result<()>>, @@ -143,6 +146,7 @@ impl DbVersion { DbVersion::One => 1, DbVersion::Two => 2, DbVersion::Three => 3, + DbVersion::Four => 4, DbVersion::Empty => unreachable!("A empty version does not have an associated integer"), } @@ -154,11 +158,13 @@ impl DbVersion { (1, "yt") => Ok(DbVersion::One), (2, "yt") => Ok(DbVersion::Two), (3, "yt") => Ok(DbVersion::Three), + (4, "yt") => Ok(DbVersion::Four), (0, other) => bail!("Db version is Zero, but got unknown namespace: '{other}'"), (1, other) => bail!("Db version is One, but got unknown namespace: '{other}'"), (2, other) => bail!("Db version is Two, but got unknown namespace: '{other}'"), (3, other) => bail!("Db version is Three, but got unknown namespace: '{other}'"), + (4, other) => bail!("Db version is Four, but got unknown namespace: '{other}'"), (other, "yt") => bail!("Got unkown version for 'yt' namespace: {other}"), (num, nasp) => bail!("Got unkown version number ({num}) and namespace ('{nasp}')"), @@ -188,8 +194,12 @@ impl DbVersion { make_upgrade! {app, Self::Two, Self::Three, "./sql/3_Two_to_Three.sql"} } - // This is the current_version Self::Three => { + make_upgrade! {app, Self::Three, Self::Four, "./sql/4_Three_to_Four.sql"} + } + + // This is the current_version + Self::Four => { assert_eq!(self, CURRENT_VERSION); assert_eq!(self, get_version(app).await?); Ok(()) |