Versioned migration coordinator for phoenix_kit_web_analytics — the module
returned from PhoenixKitWebAnalytics.migration_module/0.
mix phoenix_kit.update discovers this, compares migrated_version_runtime/1
(what's installed) with current_version/0 (what the code needs), and — when
behind — generates a host migration whose up/0 calls up/1 here. So the
host installs/updates this module's tables with no hand-written migration,
and it honors the host's --prefix (named-schema installs).
Version is tracked via a COMMENT ON TABLE on
phoenix_kit_web_analytics_events (mirroring core's own
PhoenixKit.Migrations.Postgres and PhoenixKitBoards.Migrations) — not
just a boolean "does the table exist", so a future V2 can tell "not
installed" apart from "installed at V1".
Versions:
0— tables absent (not installed)1—phoenix_kit_web_analytics_events+phoenix_kit_web_analytics_daily_stats, UUIDv7 primary keys
Prefix safety
Every statement passes prefix: through, index names are bare (Postgres
scopes an index to its table's schema), and existence checks are anchored to
the target schema — so a --prefix "analytics" install lands entirely
inside that schema.
Summary
Functions
The version this code expects the schema to be at.
Roll back. Migration-context only.
The version currently installed in the database (0 if the table is absent).
Migration-context only — reads via Ecto.Migration.repo/0.
Runtime-safe version of migrated_version/1 — uses PhoenixKit's configured
repo instead of the Ecto.Migration repo() helper, so it can be called
from Mix tasks and other non-migration contexts (mix phoenix_kit.update).
Run migrations up to (and including) the target version. Migration-context only.
Types
Functions
@spec current_version() :: pos_integer()
The version this code expects the schema to be at.
@spec down(opts()) :: :ok
Roll back. Migration-context only.
@spec migrated_version(opts()) :: non_neg_integer()
The version currently installed in the database (0 if the table is absent).
Migration-context only — reads via Ecto.Migration.repo/0.
@spec migrated_version_runtime(opts()) :: non_neg_integer()
Runtime-safe version of migrated_version/1 — uses PhoenixKit's configured
repo instead of the Ecto.Migration repo() helper, so it can be called
from Mix tasks and other non-migration contexts (mix phoenix_kit.update).
@spec up(opts()) :: :ok
Run migrations up to (and including) the target version. Migration-context only.