PhoenixKit 1.7.105: A language for each document template
PhoenixKit 1.7.105 adds migration V110, which gives each Document Creator template an optional language, such as en-US or et-EE. Existing templates keep no language until one is set. Documents take the language of their template.
For developers, PhoenixKit.Migration.ensure_current/2 applies any new PhoenixKit migrations every time it runs. The earlier test setup recorded PhoenixKit’s migration once and then skipped it, so a test database could stay at an old version after an update. Migrations run with mix ecto.migrate or mix phoenix_kit.update are unchanged.
Upgrading
Run mix phoenix_kit.update for V110.
Full release notes: PhoenixKit 1.7.105
1.7.105 · 5 May 2026
Added
PhoenixKit.Migration.ensure_current/2— re-runnable analog ofmix ecto.migratefor test helpers and any boot path running against a long-lived database (PR #515)- Passes a fresh wall-clock version (
:os.system_time(:microsecond)) toEcto.Migrator.up/4on every call so Ecto sees a “new” migration each time and invokes the inner runner; PhoenixKit’s own marker (the comment on thephoenix_kittable) short-circuits internally if there’s nothing new to apply - Forwards
:prefixfrom the Ecto.Migration runner context inside the new privatePhoenixKit.Migration.Runnerwrapper so callers passingprefix: "auth"aren’t silently routed to"public" - Microsecond precision keeps the collision and clock-skew windows small enough that an NTP correction would have to rewind the clock by µs at exactly the wrong moment to hide a newly-shipped migration; bigint-safe (Postgres covers ~292 years)
- The
schema_migrationstable accumulates one row per call — cosmetic noise acceptable for the test-DB use case; production migrations viamix ecto.migrate/mix phoenix_kit.updateremain unchanged
- Passes a fresh wall-clock version (
- V110 migration: nullable
language VARCHAR(10)column onphoenix_kit_doc_templatesso each Document Creator template can be tagged with a single locale (PR #515)- Full locale codes (
en-US,et-EE,ja) — matchesPhoenixKit.Module.Languages.get_enabled_languages/0output; lossless, consumers that want bare base codes can derive them viaDialectMapper.dialect_to_base/1 - Existing rows survive without a backfill; the form (landing in
phoenix_kit_document_creatorseparately) pre-selects the project’s primary language when creating new templates - Documents intentionally do not get a language column — they inherit from
template_uuid → templates.language @current_version109 → 110; ⚡ LATEST tag moved off V109 onto V110
- Full locale codes (
PhoenixKit.Migration.Runner.runner_opts/1— pure transform of the runner-context prefix into opts threaded toPhoenixKit.Migration.up/1/down/1(PR #515 review follow-up)- Split out of the previous closure-style
runner_opts/0so the prefix-forwarding behaviour can be regression-tested without spinning up a realEcto.Migration.Runnerprocess (which conflicts with the Ecto sandbox) - Three new unit assertions in
test/phoenix_kit/migration_test.exspin the contract:nil → [](drop, sowith_defaults/2‘s"public"default isn’t clobbered),"auth" → [prefix: "auth"], arbitrary tenant prefix forwarded verbatim. If someone “simplifies”runner_optsto always return[], CI now fails
- Split out of the previous closure-style
- “Return contract” section in the
ensure_current/2moduledoc clarifying that failures (advisory-lock contention, migration crashes, connection errors) raise fromEcto.Migrator.up/4rather than being wrapped in{:error, _}(PR #515 review follow-up)
Changed
test/test_helper.exsswitched from path-formEcto.Migrator.run(repo, migrations_path, :up, all: true)toPhoenixKit.Migration.ensure_current/2(PR #515)- Deletes the now-redundant wrapper migration
test/support/postgres/migrations/20260316000000_add_phoenix_kit.exs
- Deletes the now-redundant wrapper migration
AGENTS.mdtest-infra section updated:test_helper.exsis now the canonical migration application point, with a Do not warning against the stale tuple formEcto.Migrator.run(repo, [{0, PhoenixKit.Migration}], :up, all: true)(PR #515)
Fixed
- Documented test-helper migration patterns silently went stale after the first run (PR #515)
- Both the tuple form (
Ecto.Migrator.run(repo, [{0, PhoenixKit.Migration}], :up, all: true), documented indev_docs/migration_cleanup.md) and the path form (used by core’s own test_helper via the20260316000000_add_phoenix_kit.exswrapper) hit the same trap: Ecto.Migrator records the version inschema_migrationsafter the first call and filters that entry out of pending on every subsequent boot.PhoenixKit.Migration.up/1was never re-invoked, so newly-shipped Vxxx migrations didn’t apply on subsequent boots even though PhoenixKit’s own marker was idempotent. Symptom:column ... does not existaftermix deps.update phoenix_kitbrought in new migrations but the test DB stayed at the old marker - Verified empirically — core’s own
phoenix_kit_testwas at marker 107 even though Hex 1.7.103 shipped V108 + V109; first boot after switching toensure_current/2advanced the marker through V108 / V109 / V110 correctly
- Both the tuple form (
PhoenixKit 1.7.105. Install or update: {:phoenix_kit, "~> 1.7"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.