module
Prostore::Migration::State
Overview
CRUD over the prostore_migration and prostore_migration_step
bookkeeping tables (ADR-0009). Pure data layer; the runner orchestrates
the higher-level state transitions.
All SQL strings build placeholders via adapter.placeholder(n) so the
same code works against SQLite (?) and PostgreSQL ($N) — crystal-db
does not translate between the two.
Extended Modules
Defined in:
prostore/migration/state.crConstant Summary
-
MIGRATION_ABORTED =
"aborted" -
MIGRATION_COMPLETE =
"complete" -
MIGRATION_FAILED =
"failed" -
MIGRATION_PENDING =
"pending" -
MIGRATION_RUNNING =
"running" -
STEP_COMPLETE =
"complete" -
STEP_FAILED =
"failed" -
STEP_PENDING =
"pending" -
STEP_RUNNING =
"running"
Instance Method Summary
- #find_in_progress(adapter, executor : Adapter::Base::Executor) : MigrationRow | Nil
- #insert_migration(adapter, executor : Adapter::Base::Executor, source_hash : String, target_hash : String) : Int64
- #insert_steps(adapter, executor : Adapter::Base::Executor, migration_id : Int64, steps : Array(Steps::Kind::Any)) : Nil
- #mark_migration_aborted(adapter, executor : Adapter::Base::Executor, id : Int64) : Nil
- #mark_migration_complete(adapter, executor : Adapter::Base::Executor, id : Int64) : Nil
- #mark_migration_failed(adapter, executor : Adapter::Base::Executor, id : Int64, error : String) : Nil
- #mark_migration_running(adapter, executor : Adapter::Base::Executor, id : Int64) : Nil
- #mark_step_complete(adapter, executor : Adapter::Base::Executor, migration_id : Int64, ordinal : Int32) : Nil
- #mark_step_failed(adapter, executor : Adapter::Base::Executor, migration_id : Int64, ordinal : Int32) : Nil
- #mark_step_running(adapter, executor : Adapter::Base::Executor, migration_id : Int64, ordinal : Int32) : Nil
- #steps_for(adapter, executor : Adapter::Base::Executor, migration_id : Int64) : Array(StepRow)
Instance Method Detail
def insert_migration(adapter, executor : Adapter::Base::Executor, source_hash : String, target_hash : String) : Int64
#
def insert_steps(adapter, executor : Adapter::Base::Executor, migration_id : Int64, steps : Array(Steps::Kind::Any)) : Nil
#
def mark_migration_aborted(adapter, executor : Adapter::Base::Executor, id : Int64) : Nil
#
def mark_migration_complete(adapter, executor : Adapter::Base::Executor, id : Int64) : Nil
#
def mark_migration_failed(adapter, executor : Adapter::Base::Executor, id : Int64, error : String) : Nil
#
def mark_migration_running(adapter, executor : Adapter::Base::Executor, id : Int64) : Nil
#
def mark_step_complete(adapter, executor : Adapter::Base::Executor, migration_id : Int64, ordinal : Int32) : Nil
#
def mark_step_failed(adapter, executor : Adapter::Base::Executor, migration_id : Int64, ordinal : Int32) : Nil
#
def mark_step_running(adapter, executor : Adapter::Base::Executor, migration_id : Int64, ordinal : Int32) : Nil
#