You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: develop/parachains/maintenance/runtime-upgrades.md
+2-34Lines changed: 2 additions & 34 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -49,38 +49,6 @@ The runtime metadata should only change when the chain's [runtime `spec_version`
49
49
50
50
## StorageMigrations
51
51
52
-
[Storage migrations](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/frame_runtime_upgrades_and_migrations/index.html#migrations){target=\_blank} are custom, one-time functions that allow you to update storage to adapt to changes in the runtime.
52
+
Some runtime upgrades require updating how data is stored to match new formats or layouts.This process is called a StorageMigration.It ensures the runtime can interpret existing state correctly after an upgrade.
53
53
54
-
For example, if a runtime upgrade changes the data type used to represent user balances from an unsigned integer to a signed integer, the storage migration would read the existing value as an unsigned integer and write back an updated value that has been converted to a signed integer.
55
-
56
-
If you don't make changes to how data is stored when needed, the runtime can't properly interpret the storage values to include in the runtime state and is likely to lead to undefined behavior.
57
-
58
-
### StorageMigrations with FRAME
59
-
60
-
FRAME storage migrations are implemented using the [`OnRuntimeUpgrade`](https://paritytech.github.io/polkadot-sdk/master/frame_support/traits/trait.OnRuntimeUpgrade.html){target=\_blank} trait. The `OnRuntimeUpgrade` trait specifies a single function, `on_runtime_upgrade`, that allows you to specify logic to run immediately after a runtime upgrade but before any `on_initialize` functions or transactions are executed.
61
-
62
-
For further details about this process, see the [StorageMigrations](/develop/parachains/maintenance/storage-migrations/){target=\_blank} page.
63
-
64
-
### OrderingMigrations
65
-
66
-
By default, FRAME orders the execution of `on_runtime_upgrade` functions based on the order in which the pallets appear in the `construct_runtime!` macro.The functions run in reverse order for upgrades, starting with the last pallet executed first.You can impose a custom order if needed.
67
-
68
-
FRAME storage migrations run in this order:
69
-
70
-
1.Custom `on_runtime_upgrade` functions if using a custom order
For detailed guidance, scenarios, and implementation patterns, see [StorageMigrations](/develop/parachains/maintenance/storage-migrations/){target=\_blank} page.
Copy file name to clipboardExpand all lines: llms.txt
+2-34Lines changed: 2 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -5918,41 +5918,9 @@ The runtime metadata should only change when the chain's [runtime `spec_version`
5918
5918
5919
5919
## Storage Migrations
5920
5920
5921
-
[Storage migrations](https://paritytech.github.io/polkadot-sdk/master/polkadot_sdk_docs/reference_docs/frame_runtime_upgrades_and_migrations/index.html#migrations){target=\_blank} are custom, one-time functions that allow you to update storage to adapt to changes in the runtime.
5921
+
Some runtime upgrades require updating how data is stored to match new formats or layouts. This process is called a Storage Migration. It ensures the runtime can interpret existing state correctly after an upgrade.
5922
5922
5923
-
For example, if a runtime upgrade changes the data type used to represent user balances from an unsigned integer to a signed integer, the storage migration would read the existing value as an unsigned integer and write back an updated value that has been converted to a signed integer.
5924
-
5925
-
If you don't make changes to how data is stored when needed, the runtime can't properly interpret the storage values to include in the runtime state and is likely to lead to undefined behavior.
5926
-
5927
-
### Storage Migrations with FRAME
5928
-
5929
-
FRAME storage migrations are implemented using the [`OnRuntimeUpgrade`](https://paritytech.github.io/polkadot-sdk/master/frame_support/traits/trait.OnRuntimeUpgrade.html){target=\_blank} trait. The `OnRuntimeUpgrade` trait specifies a single function, `on_runtime_upgrade`, that allows you to specify logic to run immediately after a runtime upgrade but before any `on_initialize` functions or transactions are executed.
5930
-
5931
-
For further details about this process, see the [Storage Migrations](/develop/parachains/maintenance/storage-migrations/){target=\_blank} page.
5932
-
5933
-
### Ordering Migrations
5934
-
5935
-
By default, FRAME orders the execution of `on_runtime_upgrade` functions based on the order in which the pallets appear in the `construct_runtime!` macro. The functions run in reverse order for upgrades, starting with the last pallet executed first. You can impose a custom order if needed.
5936
-
5937
-
FRAME storage migrations run in this order:
5938
-
5939
-
1. Custom `on_runtime_upgrade` functions if using a custom order
5940
-
2. System `frame_system::on_runtime_upgrade` functions
5941
-
3. All `on_runtime_upgrade` functions defined in the runtime starting with the last pallet in the `construct_runtime!` macro
5942
-
5943
-
<!-- ## Where to Go Next
5944
-
5945
-
<div class="grid cards" markdown>
5946
-
5947
-
- <span class="badge tutorial">Tutorial</span> __Add Pallets to the Runtime__
5948
-
5949
-
---
5950
-
5951
-
TODO!
5952
-
5953
-
[:octicons-arrow-right-24: Get started](/tutorials/polkadot-sdk/parachains/zero-to-hero/add-pallets-to-runtime/)
5954
-
5955
-
</div> -->
5923
+
For detailed guidance, scenarios, and implementation patterns, see [Storage Migrations](/develop/parachains/maintenance/storage-migrations/){target=\_blank} page.
0 commit comments