Function run_migration_chain

Source
pub fn run_migration_chain<M: Migrator>(
    migrations: Vec<M>,
    target: u32,
) -> Result<(), MigrationChainError>
Expand description

Validate an ordered migration chain end-to-end, then run each step in sequence.

Every invariant is checked before any transform runs, so an invalid chain reverts without writing state:

  1. the list is non-empty,
  2. the first migration’s input version equals the stored state version,
  3. each migration’s output version equals the next migration’s input version, and
  4. the last migration’s output version equals target.

Only then are the migrations run in order; each Migrator::run independently re-asserts stored == input_version() and bumps the stored version to its output.