Merge pull request #5523 from meilisearch/rollback-updates

Allow rollbacking updates
This commit is contained in:
Many the fish 2025-05-05 09:53:56 +00:00 committed by GitHub
commit 71ab11f1fe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 1794 additions and 1518 deletions

View file

@ -272,9 +272,9 @@ impl KindWithContent {
KindWithContent::UpgradeDatabase { from } => Some(Details::UpgradeDatabase {
from: (from.0, from.1, from.2),
to: (
versioning::VERSION_MAJOR.parse().unwrap(),
versioning::VERSION_MINOR.parse().unwrap(),
versioning::VERSION_PATCH.parse().unwrap(),
versioning::VERSION_MAJOR,
versioning::VERSION_MINOR,
versioning::VERSION_PATCH,
),
}),
}
@ -338,9 +338,9 @@ impl KindWithContent {
KindWithContent::UpgradeDatabase { from } => Some(Details::UpgradeDatabase {
from: *from,
to: (
versioning::VERSION_MAJOR.parse().unwrap(),
versioning::VERSION_MINOR.parse().unwrap(),
versioning::VERSION_PATCH.parse().unwrap(),
versioning::VERSION_MAJOR,
versioning::VERSION_MINOR,
versioning::VERSION_PATCH,
),
}),
}
@ -386,9 +386,9 @@ impl From<&KindWithContent> for Option<Details> {
KindWithContent::UpgradeDatabase { from } => Some(Details::UpgradeDatabase {
from: *from,
to: (
versioning::VERSION_MAJOR.parse().unwrap(),
versioning::VERSION_MINOR.parse().unwrap(),
versioning::VERSION_PATCH.parse().unwrap(),
versioning::VERSION_MAJOR,
versioning::VERSION_MINOR,
versioning::VERSION_PATCH,
),
}),
}

View file

@ -8,9 +8,7 @@ use tempfile::NamedTempFile;
/// The name of the file that contains the version of the database.
pub const VERSION_FILE_NAME: &str = "VERSION";
pub static VERSION_MAJOR: &str = env!("CARGO_PKG_VERSION_MAJOR");
pub static VERSION_MINOR: &str = env!("CARGO_PKG_VERSION_MINOR");
pub static VERSION_PATCH: &str = env!("CARGO_PKG_VERSION_PATCH");
pub use milli::constants::{VERSION_MAJOR, VERSION_MINOR, VERSION_PATCH};
/// Persists the version of the current Meilisearch binary to a VERSION file
pub fn create_current_version_file(db_path: &Path) -> anyhow::Result<()> {
@ -19,9 +17,9 @@ pub fn create_current_version_file(db_path: &Path) -> anyhow::Result<()> {
pub fn create_version_file(
db_path: &Path,
major: &str,
minor: &str,
patch: &str,
major: u32,
minor: u32,
patch: u32,
) -> anyhow::Result<()> {
let version_path = db_path.join(VERSION_FILE_NAME);
// In order to persist the file later we must create it in the `data.ms` and not in `/tmp`