Legal 0.4.0: The consent log table gets its own migration chain
Legal 0.4.0 moves the future of the consent log table, phoenix_kit_consent_logs, from PhoenixKit core into the Legal module. Nothing about the table changes on a live site.
A module-owned migration chain
The new chain is PhoenixKit.Modules.Legal.Migrations, and it runs through mix phoenix_kit.update. Its first step, V1, does not create anything new. Core’s V135 baseline still creates the table on every install; V1 re-states exactly that shape and marks the table with a pkl_schema:1 comment. Later changes to the table will ship as new steps of this chain.
The column widths in the migration come from the same map the consent log’s validations use, so the two can no longer disagree.
Rolling the chain back only removes the marker. It never drops the table or deletes rows, since the rows are the site’s consent audit trail.
Building on newer Erlang versions
The package now lists rustler as an optional dependency, as core does. It lets the Markdown library’s native code build from source on Erlang/OTP versions without a matching precompiled build.
Upgrading
Update the dependency and run mix phoenix_kit.update. A wrapper migration marks the existing table and nothing else changes. Sites without Legal, and new installs, are unaffected. No core update is required.
Full release notes: Legal 0.4.0
0.4.0 · 11 August 2026
Changed
-
phoenix_kit_consent_logs’ future shape now belongs to a module-owned migration chain (#16),PhoenixKit.Modules.Legal.Migrations, markerpkl_schema:<N>. V1 is an adoption, not a create: core’s V135 baseline still creates the table on every install, and V1 re-asserts that exact shape idempotently and stamps the marker. Because no shape changes, core’sExpectedSchemastays accurate — no core release is required and there is no release-ordering hazard.This revisits the same-day 0.3.0/0.3.1 “core owns it” pin deliberately. That cleanup killed two drifted in-package DDL copies and stands; this is the extraction it made safe, with the drift class solved at the root —
up_statements/1interpolatesConsentLog.column_widths/0and there is no second copy of those numbers anywhere in the package.down/1can never drop the table. It unstamps the marker and nothing else: the rows are a GDPR/CCPA consent audit trail and on most installs the table is core-created. Test-pinned — no statement in either direction may matchDROP/TRUNCATE/DELETE.Existing hosts: upgrade, then
mix phoenix_kit.update; a wrapper migration stampspkl_schema:1and nothing else changes. New hosts and hosts without Legal: unchanged.The V2+ shape-change protocol (core’s
@excluded_exact+ manifest regeneration, then a core-floor bump here) is indev_docs/reports/2026-08-10-consent-logs-extraction.md. -
Carries core’s rustler escape hatch (
{:rustler, ">= 0.0.0", optional: true}) so MDEx’s NIF builds from source on OTP versions shipping no compatible precompiled NIF.
Added
- The ownership test now cross-checks every column against core’s manifest
— names, types, defaults and nullability — not only the varchar widths. A
width-only comparison passes while a type, a default or a
NOT NULLdrifts, which is the same blind spot that produced three disagreeing DDLs in the first place.
Legal 0.4.0. Install or update: {:phoenix_kit_legal, "~> 0.4"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.