/home/runner/work/creditcoin/creditcoin/pallets/creditcoin/src/migrations/mod.rs
Line | Count | Source (jump to first uncovered line) |
1 | | use crate::{Config, Pallet}; |
2 | | use frame_support::{traits::StorageVersion, weights::Weight}; |
3 | | |
4 | | mod v1; |
5 | | mod v2; |
6 | | mod v3; |
7 | | mod v4; |
8 | | mod v5; |
9 | | mod v6; |
10 | | |
11 | 0 | pub(crate) fn migrate<T: Config>() -> Weight { |
12 | 0 | let version = StorageVersion::get::<Pallet<T>>(); |
13 | 0 | let mut weight: Weight = 0; |
14 | 0 |
|
15 | 0 | if version < 1 { |
16 | 0 | weight = weight.saturating_add(v1::migrate::<T>()); |
17 | 0 | StorageVersion::new(1).put::<Pallet<T>>(); |
18 | 0 | } |
19 | | |
20 | 0 | if version < 2 { |
21 | 0 | weight = weight.saturating_add(v2::migrate::<T>()); |
22 | 0 | StorageVersion::new(2).put::<Pallet<T>>(); |
23 | 0 | } |
24 | | |
25 | 0 | if version < 3 { |
26 | 0 | weight = weight.saturating_add(v3::migrate::<T>()); |
27 | 0 | StorageVersion::new(3).put::<Pallet<T>>(); |
28 | 0 | } |
29 | | |
30 | 0 | if version < 4 { |
31 | 0 | weight = weight.saturating_add(v4::migrate::<T>()); |
32 | 0 | StorageVersion::new(4).put::<Pallet<T>>(); |
33 | 0 | } |
34 | | |
35 | 0 | if version < 5 { |
36 | 0 | weight = weight.saturating_add(v5::migrate::<T>()); |
37 | 0 | StorageVersion::new(5).put::<Pallet<T>>(); |
38 | 0 | } |
39 | | |
40 | 0 | if version < 6 { |
41 | 0 | weight = weight.saturating_add(v6::migrate::<T>()); |
42 | 0 | StorageVersion::new(6).put::<Pallet<T>>(); |
43 | 0 | } |
44 | | |
45 | 0 | weight |
46 | 0 | } |