module
Prostore::Migration::Internal
Overview
Internal-schema version tracking and stepwise upgrades for prostore's own bookkeeping tables.
Why this exists: prostore's prostore_* tables are managed by the
library itself, not by user-authored migrations. When their layout
changes between library versions (e.g., v2 lifts prostore_schema's
JSON definition into typed columns) we need a controlled,
idempotent upgrade path against existing installs.
Migration::Runner calls Internal.run at the top of the bootstrap
path, before Bookkeeping.ensure_tables and before any user-migration
work. The prostore_meta row schema_version tracks the applied
version; this module owns its read/write.
Extended Modules
Defined in:
prostore/migration/internal.crConstant Summary
-
CURRENT_SCHEMA_VERSION =
3
Instance Method Summary
-
#detect_current_version(adapter : Prostore::Adapter::Base, executor : Prostore::Adapter::Base::Executor) : Int32
Returns the version the database is currently at.
-
#run(adapter : Prostore::Adapter::Base, executor : Prostore::Adapter::Base::Executor) : Nil
Entry point.
- #steps : Hash(Int32, Step)
Instance Method Detail
Returns the version the database is currently at. If prostore_meta
holds an explicit schema_version, that is authoritative. Otherwise
the layout of prostore_schema tells us where we stand: a definition
column means v1; absence of enum_members means v2 (the typed-columns
split has run but enum support hasn't); both present (or table absent
entirely) means we are at the current version.
Entry point. Always ensures prostore_meta exists, detects the
current version, then applies any pending step in ascending order.
Raises if user migrations are in flight (see refuse_if_in_flight!).