Skip to content

Commit

Permalink
fix: getting storage version for continues update (#347)
Browse files Browse the repository at this point in the history
* fix: mutable version for continues update

* chore: bump version to 2.1.4
  • Loading branch information
irmannmal authored Aug 30, 2022
1 parent 2635ea8 commit 006a2ed
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = 'debio'
version = '2.1.3'
version = '2.1.4'
edition = '2021'
license = 'AGPL-3.0'
authors = ['DeBio Dev Team <[email protected]>']
Expand Down
4 changes: 3 additions & 1 deletion pallets/genetic-analysts/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ use primitives_verification_status::VerificationStatus;
pub fn migrate<T: Config>() -> Weight {
use frame_support::traits::StorageVersion;

let version = StorageVersion::get::<Pallet<T>>();
let mut version = StorageVersion::get::<Pallet<T>>();
let mut weight: Weight = 0;

if version < 2 {
weight = weight.saturating_add(v2::migrate::<T>());
StorageVersion::new(2).put::<Pallet<T>>();
}

version = StorageVersion::get::<Pallet<T>>();

if version == 2 {
weight = weight.saturating_add(v3::migrate::<T>());
StorageVersion::new(3).put::<Pallet<T>>();
Expand Down
4 changes: 3 additions & 1 deletion pallets/labs/src/migrations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ use primitives_verification_status::VerificationStatus;
pub fn migrate<T: Config>() -> Weight {
use frame_support::traits::StorageVersion;

let version = StorageVersion::get::<Pallet<T>>();
let mut version = StorageVersion::get::<Pallet<T>>();
let mut weight: Weight = 0;

if version < 2 {
weight = weight.saturating_add(v2::migrate::<T>());
StorageVersion::new(2).put::<Pallet<T>>();
}

version = StorageVersion::get::<Pallet<T>>();

if version == 2 {
weight = weight.saturating_add(v3::migrate::<T>());
StorageVersion::new(3).put::<Pallet<T>>();
Expand Down
2 changes: 1 addition & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = 'debio-runtime'
version = '2.1.3'
version = '2.1.4'
edition = '2021'
license = 'AGPL-3.0'
authors = ['DeBio Dev Team <[email protected]>']
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// the compatible custom types.
spec_version: 2013,
spec_version: 2014,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down

0 comments on commit 006a2ed

Please sign in to comment.