Module-owned migration chain for the entities tables (phoenix_kit_entities,
phoenix_kit_entity_data). V1 is purely adoptive: core's V135 (+V169) still
creates the same tables, so every statement is idempotent and name-identical
to core's objects (authority: the live V182 schema). The pkn_schema:<N>
marker on phoenix_kit_entities is the version; down/1 only unstamps.
Protocol: phoenix_kit_hello_world README, "Adopting a table core already
creates (extraction)".
Core's v169 both drops and re-adds NOT NULL on
phoenix_kit_entity_data.created_by_uuid (v169.ex:77 vs :200); the live
schema (authority for this chain) has it nullable, so created_by_uuid is
adopted here without NOT NULL.
Summary
Functions
The chain version this code ships.
Rolls the marker back to :version in opts (default 0). Never drops a
table or a row — see the moduledoc.
The SQL down/1 executes, as data (marker bookkeeping only).
The applied chain version, read INSIDE a migration (uses Ecto.Migration's
repo(), so it raises outside migration context — migrated_version_runtime/1
is the caller-safe form).
The applied chain version, read OUTSIDE a migration — the protocol shape
mix phoenix_kit.status / mix phoenix_kit.update call.
Adopts (or, on a core baseline that no longer ships them, creates) the tables. Idempotent.
The SQL up/1 executes, as data (so the shape can be test-pinned).
The table carrying the pkn_schema:<N> marker (auditor contract).
Functions
@spec current_version() :: pos_integer()
The chain version this code ships.
Rolls the marker back to :version in opts (default 0). Never drops a
table or a row — see the moduledoc.
@spec down_statements(String.t(), non_neg_integer()) :: [String.t()]
The SQL down/1 executes, as data (marker bookkeeping only).
@spec migrated_version(keyword() | map()) :: non_neg_integer()
The applied chain version, read INSIDE a migration (uses Ecto.Migration's
repo(), so it raises outside migration context — migrated_version_runtime/1
is the caller-safe form).
@spec migrated_version_runtime(keyword() | map()) :: non_neg_integer()
The applied chain version, read OUTSIDE a migration — the protocol shape
mix phoenix_kit.status / mix phoenix_kit.update call.
A marker-less table (or one carrying someone else's prose comment) reads as
0: the pre-chain, core-baseline shape. An unusable prefix RAISES rather
than reporting 0 — "not installed" and "you gave me a prefix I cannot
query" must not look the same to the update task. Everything else degrades
to 0; catch :exit matters as much as rescue, because a dead connection
pool exits rather than raising.
Adopts (or, on a core baseline that no longer ships them, creates) the tables. Idempotent.
The SQL up/1 executes, as data (so the shape can be test-pinned).
@spec version_table() :: String.t()
The table carrying the pkn_schema:<N> marker (auditor contract).