mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 09:21:05 +00:00
Improve VersionedMigration naming conventions (#2264)
As suggested by @ggwpez (https://github.com/paritytech/polkadot-sdk/pull/2142#discussion_r1388145872), remove the `VersionChecked` prefix from version checked migrations (but leave `VersionUnchecked` prefixes) --------- Co-authored-by: command-bot <>
This commit is contained in:
@@ -25,8 +25,8 @@ use sp_std::vec::Vec;
|
||||
pub mod v1 {
|
||||
|
||||
use super::*;
|
||||
pub struct MigrateToV1<T>(sp_std::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for MigrateToV1<T> {
|
||||
pub struct VersionUncheckedMigrateToV1<T>(sp_std::marker::PhantomData<T>);
|
||||
impl<T: Config> OnRuntimeUpgrade for VersionUncheckedMigrateToV1<T> {
|
||||
#[cfg(feature = "try-runtime")]
|
||||
fn pre_upgrade() -> Result<Vec<u8>, sp_runtime::TryRuntimeError> {
|
||||
let onchain_version = Pallet::<T>::on_chain_storage_version();
|
||||
@@ -60,13 +60,13 @@ pub mod v1 {
|
||||
}
|
||||
}
|
||||
|
||||
/// [`MigrateToV1`] wrapped in a
|
||||
/// [`VersionUncheckedMigrateToV1`] wrapped in a
|
||||
/// [`VersionedMigration`](frame_support::migrations::VersionedMigration), ensuring the
|
||||
/// migration is only performed when on-chain version is 0.
|
||||
pub type VersionCheckedMigrateToV1<T> = frame_support::migrations::VersionedMigration<
|
||||
pub type MigrateToV1<T> = frame_support::migrations::VersionedMigration<
|
||||
0,
|
||||
1,
|
||||
MigrateToV1<T>,
|
||||
VersionUncheckedMigrateToV1<T>,
|
||||
Pallet<T>,
|
||||
<T as frame_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
@@ -60,11 +60,10 @@ impl<T: Config, UnlockParaIds: Contains<ParaId>> OnRuntimeUpgrade
|
||||
}
|
||||
}
|
||||
|
||||
pub type VersionCheckedMigrateToV1<T, UnlockParaIds> =
|
||||
frame_support::migrations::VersionedMigration<
|
||||
0,
|
||||
1,
|
||||
VersionUncheckedMigrateToV1<T, UnlockParaIds>,
|
||||
super::Pallet<T>,
|
||||
<T as frame_system::Config>::DbWeight,
|
||||
>;
|
||||
pub type MigrateToV1<T, UnlockParaIds> = frame_support::migrations::VersionedMigration<
|
||||
0,
|
||||
1,
|
||||
VersionUncheckedMigrateToV1<T, UnlockParaIds>,
|
||||
super::Pallet<T>,
|
||||
<T as frame_system::Config>::DbWeight,
|
||||
>;
|
||||
|
||||
Reference in New Issue
Block a user