Skip to content

Commit

Permalink
Rename migration name
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrylavrenov committed Nov 8, 2024
1 parent 7f084fa commit 33c8854
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions crates/humanode-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -930,8 +930,8 @@ pub type Executive = frame_executive::Executive<
(
pallet_dummy_precompiles_code::UpgradeInit<Runtime>,
pallet_balanced_currency_swap_bridges_initializer::UpgradeInit<Runtime>,
pallet_erc20_support::MigrationToV1<Runtime>,
pallet_humanode_session::MigrationToV1<Runtime>,
pallet_erc20_support::MigrationV0ToV1<Runtime>,
pallet_humanode_session::MigrationV0ToV1<Runtime>,
),
>;

Expand Down
2 changes: 1 addition & 1 deletion crates/pallet-erc20-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use frame_support::{
pub use pallet::*;

mod migrations;
pub use migrations::v1::MigrationToV1;
pub use migrations::v1::MigrationV0ToV1;

#[cfg(test)]
mod mock;
Expand Down
8 changes: 4 additions & 4 deletions crates/pallet-erc20-support/src/migrations/v1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Migration to Version 1.
//! Migration to Version 1 from Version 0.

#[cfg(feature = "try-runtime")]
use frame_support::sp_std::{vec, vec::Vec};
Expand All @@ -12,10 +12,10 @@ use frame_support::{

use crate::{Approvals, BalanceOf, Config, Pallet};

/// Execute migration to Version 1.
pub struct MigrationToV1<T, I = ()>(sp_std::marker::PhantomData<(T, I)>);
/// Execute migration to Version 1 from Version 0.
pub struct MigrationV0ToV1<T, I = ()>(sp_std::marker::PhantomData<(T, I)>);

impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for MigrationToV1<T, I> {
impl<T: Config<I>, I: 'static> OnRuntimeUpgrade for MigrationV0ToV1<T, I> {
fn on_runtime_upgrade() -> Weight {
migrate::<T, I>()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/pallet-humanode-session/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub use weights::*;
pub mod weights;

mod migrations;
pub use migrations::v1::MigrationToV1;
pub use migrations::v1::MigrationV0ToV1;

#[cfg(feature = "runtime-benchmarks")]
pub mod benchmarking;
Expand Down
10 changes: 5 additions & 5 deletions crates/pallet-humanode-session/src/migrations/v1.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Migration to Version 1.
//! Migration to Version 1 from Version 0.

#[cfg(feature = "try-runtime")]
use frame_support::sp_std::{vec, vec::Vec};
Expand All @@ -12,10 +12,10 @@ use frame_support::{

use crate::{Config, CurrentSessionIndex, IdentificationFor, Pallet, SessionIdentities};

/// Execute migration to Version 1.
pub struct MigrationToV1<T>(sp_std::marker::PhantomData<T>);
/// Execute migration to Version 1 from Version 0.
pub struct MigrationV0ToV1<T>(sp_std::marker::PhantomData<T>);

impl<T: Config> OnRuntimeUpgrade for MigrationToV1<T> {
impl<T: Config> OnRuntimeUpgrade for MigrationV0ToV1<T> {
fn on_runtime_upgrade() -> Weight {
migrate::<T>()
}
Expand Down Expand Up @@ -50,7 +50,7 @@ pub fn migrate<T: Config>() -> Weight {
let mut weight: Weight = T::DbWeight::get().reads(1);

if onchain != 0 {
info!("Already not at version 0, nothing to do. This migrarion probably should be removed");
info!("Not at version 0, nothing to do. This migrarion probably should be removed");
return weight;
}

Expand Down

0 comments on commit 33c8854

Please sign in to comment.