class

Prostore::Migration::Runner

Inherits Reference < Object

The migration runner (ADR-0009).

Boot sequence:

  1. ensure_tables — bookkeeping schema present
  2. compute target fingerprint over the model registry
  3. find_in_progress — is there a pending/running/failed migration?
    • If yes: verify target_hash matches; reuse the migration id.
    • If no: validate, diff, plan, persist, insert a new migration row.
  4. claim the lease (refuse if another live lease holds it)
  5. for each pending step in ordinal order: mark_step_running → execute → mark_step_complete → heartbeat
  6. mark_migration_complete; release lease

Plan-at-start (ADR-0009 invariant 2): step list is persisted before any DDL runs. Resume reads the steps and continues from the first non- complete one — the model is NOT consulted to recompute on resume.

Schema-fingerprint enforcement (invariant 4): if the current model's target hash doesn't match an in-progress migration's target_hash, the runner refuses to start. Operator must either wait, abort, or fix the version skew.

Constructors

new(conn : Connection, models : Array(Prostore::Model.class), runner_id : String = Lease.runner_id)
Source

Class methods

migrate(conn : Connection, models : Array(Prostore::Model.class) = Prostore.models, runner_id : String = Lease.runner_id) : Nil
Source

Instance methods

compute_source_hash(executor : Adapter::Base::Executor) : String

Public so tests / tooling can compute the same hash the runner uses.

Source
compute_target_hash
Source