Function frame_support::storage::migration::move_storage_from_pallet
source · pub fn move_storage_from_pallet(
storage_name: &[u8],
old_pallet_name: &[u8],
new_pallet_name: &[u8]
)
Expand description
Move a storage from a pallet prefix to another pallet prefix.
Keys used in pallet storages always start with:
concat(twox_128(pallet_name), towx_128(storage_name))
.
This function will remove all value for which the key start with
concat(twox_128(old_pallet_name), towx_128(storage_name))
and insert them at the key with
the start replaced by concat(twox_128(new_pallet_name), towx_128(storage_name))
.
Example
If a pallet named “my_example” has 2 storages named “Foo” and “Bar” and the pallet is renamed “my_new_example_name”, a migration can be:
move_storage_from_pallet(b"Foo", b"my_example", b"my_new_example_name");
move_storage_from_pallet(b"Bar", b"my_example", b"my_new_example_name");