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 the [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
@@ -6418,41 +6418,9 @@ The runtime metadata should only change when the chain's [runtime `spec_version`
6418
6418
6419
6419
## Storage Migrations
6420
6420
6421
-
[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.
6421
+
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.
6422
6422
6423
-
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.
6424
-
6425
-
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.
6426
-
6427
-
### Storage Migrations with FRAME
6428
-
6429
-
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.
6430
-
6431
-
For further details about this process, see the [Storage Migrations](/develop/parachains/maintenance/storage-migrations/){target=\_blank} page.
6432
-
6433
-
### Ordering Migrations
6434
-
6435
-
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.
6436
-
6437
-
FRAME storage migrations run in this order:
6438
-
6439
-
1. Custom `on_runtime_upgrade` functions if using a custom order
6440
-
2. System `frame_system::on_runtime_upgrade` functions
6441
-
3. All `on_runtime_upgrade` functions defined in the runtime starting with the last pallet in the `construct_runtime!` macro
6442
-
6443
-
<!-- ## Where to Go Next
6444
-
6445
-
<div class="grid cards" markdown>
6446
-
6447
-
- <span class="badge tutorial">Tutorial</span> __Add Pallets to the Runtime__
6448
-
6449
-
---
6450
-
6451
-
TODO!
6452
-
6453
-
[:octicons-arrow-right-24: Get started](/tutorials/polkadot-sdk/parachains/zero-to-hero/add-pallets-to-runtime/)
6454
-
6455
-
</div> -->
6423
+
For detailed guidance, scenarios, and implementation patterns, see the [Storage Migrations](/develop/parachains/maintenance/storage-migrations/){target=\_blank} page.
0 commit comments