use super::*; use alloc::string::String; pub fn migrate_fix_childkeys() -> Weight { let migration_name = b"migrate_fix_childkeys".to_vec(); let mut weight = T::DbWeight::get().reads(1); if HasMigrationRun::::get(&migration_name) { log::info!( "Migration '{:?}' has already run. Skipping.", String::from_utf8_lossy(&migration_name) ); return weight; } log::info!( "Running migration '{}'", String::from_utf8_lossy(&migration_name) ); //////////////////////////////////////////////////////// // Actual migration Pallet::::clean_zero_childkey_vectors(&mut weight); Pallet::::clean_zero_parentkey_vectors(&mut weight); Pallet::::clean_self_loops(&mut weight); Pallet::::repair_child_parent_consistency(&mut weight); //////////////////////////////////////////////////////// HasMigrationRun::::insert(&migration_name, true); weight = weight.saturating_add(T::DbWeight::get().writes(1)); log::info!( target: "runtime", "Migration '{}' completed successfully.", String::from_utf8_lossy(&migration_name) ); weight }