Prostore::Migration::Runner
The migration runner (ADR-0009).
Boot sequence:
- ensure_tables — bookkeeping schema present
- compute target fingerprint over the model registry
- 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.
- claim the lease (refuse if another live lease holds it)
- for each pending step in ordinal order: mark_step_running → execute → mark_step_complete → heartbeat
- 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
Class methods
migrate(conn : Connection, models : Array(Prostore::Model.class) = Prostore.models, runner_id : String = Lease.runner_id) : Nil
SourceInstance methods
Public so tests / tooling can compute the same hash the runner uses.
compute_target_hash
Sourcerun
Source