class
Prostore::Migration::Runner
- Prostore::Migration::Runner
- Reference
- Object
Overview
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.
Defined in:
prostore/migration/runner.crConstructors
- .new(conn : Connection, models : Array(Prostore::Model.class), runner_id : String = Lease.runner_id)
Class Method Summary
Instance Method Summary
-
#compute_source_hash(executor : Adapter::Base::Executor) : String
Public so tests / tooling can compute the same hash the runner uses.
- #compute_target_hash : String
- #run : Nil
Constructor Detail
def self.new(conn : Connection, models : Array(Prostore::Model.class), runner_id : String = Lease.runner_id)
#
Class Method Detail
def self.migrate(conn : Connection, models : Array(Prostore::Model.class) = Prostore.models, runner_id : String = Lease.runner_id) : Nil
#
Instance Method Detail
def compute_source_hash(executor : Adapter::Base::Executor) : String
#
Public so tests / tooling can compute the same hash the runner uses.