feat(admin): add interactive data migration tool

This commit is contained in:
rustmailer
2026-05-12 01:56:24 +08:00
parent 123260b69d
commit 0abaa66a40
21 changed files with 1547 additions and 434 deletions
+6 -6
View File
@@ -25,11 +25,11 @@ use bichon_core::{
context::{executors::BichonContext, Initialize},
error::{code::ErrorCode, BichonResult},
logger,
migrate::is_legacy_data_layout,
migrate::check_data_status,
raise_error,
settings::cli::SETTINGS,
store::{
storage::BLOB_MANAGER,
blob::BLOB_MANAGER,
tantivy::{attachment::ATTACHMENT_MANAGER, envelope::ENVELOPE_MANAGER},
},
tasks::PeriodicTasks,
@@ -69,11 +69,11 @@ async fn main() -> BichonResult<()> {
info!("Git: [{}]", env!("GIT_HASH"));
info!("GitHub: https://github.com/rustmailer/bichon");
match is_legacy_data_layout() {
Ok(true) => {
match check_data_status() {
Ok(false) => {
error!("Incompatible data format detected.");
error!("Your data was created by an older version of Bichon and must be migrated before use.");
error!("Please run: bichon-migrate");
error!("Please run: bichon-admin");
error!("Documentation: https://github.com/rustmailer/bichon/wiki/migration");
return Err(raise_error!(
"Legacy data layout detected".into(),
@@ -84,7 +84,7 @@ async fn main() -> BichonResult<()> {
error!("Failed to check data layout: {:#?}", e);
return Err(raise_error!(format!("{:#?}", e), ErrorCode::InternalError));
}
Ok(false) => {}
Ok(true) => {}
}
if let Err(error) = initialize().await {
+1 -1
View File
@@ -36,7 +36,7 @@ use bichon_core::message::tags::TagCount;
use bichon_core::message::tags::TagsRequest;
use bichon_core::raise_error;
use bichon_core::store::envelope::Envelope;
use bichon_core::store::storage::get_reader;
use bichon_core::store::blob::get_reader;
use bichon_core::store::tantivy::envelope::ENVELOPE_MANAGER;
use bichon_core::store::tantivy::validate_facet;
use bichon_core::users::permissions::Permission;