Add support to upgrade to v1.12.3 in meilitool

This commit is contained in:
Louis Dureuil 2025-01-09 15:25:44 +01:00
parent a21711f473
commit 4070895a21
No known key found for this signature in database
6 changed files with 183 additions and 4 deletions

View file

@ -8,7 +8,7 @@ use std::path::{Path, PathBuf};
use anyhow::{bail, Context};
use meilisearch_types::versioning::create_version_file;
use v1_10::v1_9_to_v1_10;
use v1_12::v1_11_to_v1_12;
use v1_12::{v1_11_to_v1_12, v1_12_to_v1_12_3};
use crate::upgrade::v1_11::v1_10_to_v1_11;
@ -24,6 +24,7 @@ impl OfflineUpgrade {
(v1_9_to_v1_10 as fn(&Path) -> Result<(), anyhow::Error>, "1", "10", "0"),
(v1_10_to_v1_11, "1", "11", "0"),
(v1_11_to_v1_12, "1", "12", "0"),
(v1_12_to_v1_12_3, "1", "12", "3"),
];
let (current_major, current_minor, current_patch) = &self.current_version;
@ -36,6 +37,7 @@ impl OfflineUpgrade {
("1", "9", _) => 0,
("1", "10", _) => 1,
("1", "11", _) => 2,
("1", "12", x) if x == "0" || x == "1" || x == "2" => 3,
_ => {
bail!("Unsupported current version {current_major}.{current_minor}.{current_patch}. Can only upgrade from v1.9 and v1.10")
}
@ -46,7 +48,8 @@ impl OfflineUpgrade {
let ends_at = match (target_major.as_str(), target_minor.as_str(), target_patch.as_str()) {
("1", "10", _) => 0,
("1", "11", _) => 1,
("1", "12", _) => 2,
("1", "12", x) if x == "0" || x == "1" || x == "2" => 2,
("1", "12", "3") => 3,
(major, _, _) if major.starts_with('v') => {
bail!("Target version must not starts with a `v`. Instead of writing `v1.9.0` write `1.9.0` for example.")
}