Legal 0.3.0: Consent logs left to core, with length checks on every field
Legal 0.3.0 stops shipping its own migration for the consent log table and validates consent log entries against the table’s real column widths.
Core owns the consent log table
The phoenix_kit_consent_logs table is created by PhoenixKit core on every install, with or without Legal. The module had its own migration for the same table, written separately and with a different shape. It never ran, because core’s table always existed first. But rolling it back would have dropped core’s table. That migration and the module’s migration_module/0 are removed. Nothing changes at runtime.
Length checks on consent log entries
ConsentLog.create/1 had no length validations, so a value too long for its column came back as a raw database error. It now checks each field against core’s widths: session_id 64, consent_type 30, consent_version 20, ip_address 45 and user_agent_hash 64. A host app calling it gets a changeset error it can handle.
Upgrading
Nothing to run. Legal 0.3 still requires PhoenixKit ~> 2.0.
Full release notes: Legal 0.3.0
0.3.0 · 10 August 2026
Requires phoenix_kit ~> 2.0, unchanged from 0.2.0.
Removed
-
migration_module/0and the standalone consent-logs migration.phoenix_kit_consent_logsis a core table, not this package’s, and this package’s migration had never run on any host — nor could it.Legal began life inside core: the same commit that added “Legal Module Phase 1” added core’s V43, which created the table. When this package was extracted, core kept V43, and a fresh coordinator was written here from the Ecto schema rather than copied from V43 — so the two DDLs drifted. Core’s V43 DDL now lives in the squashed V135 baseline, which is unconditional: the table exists on every phoenix_kit install, with or without this package.
It could never run for two independent reasons. Core’s chain migrates before module migrations in the same task, and both DDLs are
CREATE TABLE IF NOT EXISTS— so by the time this module’sup/1was reached, the table already existed.It still mattered, because
down/1ranDROP TABLE IF EXISTS phoenix_kit_consent_logs CASCADEagainst a table core owns and that outlives this package. While the version was inferred from table existence that rollback looked unreachable; repairing the version marker would have armed it. Core 2.0 also addedPhoenixKit.Migrations.ExpectedSchema, which names this table, all 11 columns, 6 indexes and the pkey as core-owned and is whatmix phoenix_kit.doctor/mix phoenix_kit.repairverify against — so the divergent shape was one core would report as damage.No runtime change: a migration that never ran cannot stop running. Any future change to this table belongs in core’s chain.
Full analysis:
dev_docs/reports/2026-08-10-module-migration-versioning.md.
Fixed
ConsentLoghad no length validations, on any field. Core’s columns are narrower than the deleted DDL assumed —session_idisvarchar(64)(this package assumed 255) andconsent_versionisvarchar(20)(assumed 50).ConsentLog.create/1is public API host apps call, so an over-long value came back as a raw Postgres varchar-overflow error instead of a changeset error the caller could handle. Now validated at core’s exact widths:session_id64,consent_type30,consent_version20,ip_address45,user_agent_hash64.
Legal 0.3.0. Install or update: {:phoenix_kit_legal, "~> 0.3"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.