PhoenixKit 1.7.53: Migrations that no longer hang, and a doctor task
PhoenixKit 1.7.53 fixes upgrades that hung or failed during the UUID migrations, and adds mix phoenix_kit.doctor to find out why a database is stuck.
The causes were NULL UUIDs that made a backfill loop forever, orphaned rows that blocked new foreign keys, uuid columns stored as text, and the whole run of migrations sitting in one transaction that held its locks to the end. Each is fixed; V50 also gives up after 30 seconds instead of waiting on a lock. New migration V70 fills in the email log links that V56 and V63 skipped on such databases, and V71 gives shop import logs a proper product_uuids column.
mix phoenix_kit.update now starts the app without Oban, cache warmers or settings queries and with at most two database connections, and runs the migrations in the same process. mix phoenix_kit.doctor checks the connection, pool, PgBouncer, the migration state, column types, NULL UUIDs, orphaned rows, locks and Oban, and prints what to do about each problem.
Deleting a user with anonymization of their data works again. mix phoenix_kit.gen.migration now generates UUID keys.
Upgrading
Run mix phoenix_kit.update for V70 and V71.
Full release notes: PhoenixKit 1.7.53
1.7.53 · 2 March 2026
- Add
mix phoenix_kit.doctordiagnostic command — detects migration version vsschema_migrationsdiscrepancies, stale COMMENT tags, and common DB issues - Add
update_modetomix phoenix_kit.update— skips heavy DB components (Oban, cache warmers, settings queries) and caps Ecto pool at 2 during migrations to prevent DB saturation - Run
ecto.migratein-process instead ofSystem.cmdfor better error reporting and reliability - Fix three migration hang root causes: NULL UUIDs causing infinite backfill loop, orphaned FK references blocking constraint creation, varchar uuid columns crashing Ecto schema loader
- Fix migration hang: disable DDL transaction in generated migration wrapper — prevents entire multi-version migration from running in a single transaction holding AccessExclusiveLock
- Fix V50 migration hang: add
lock_timeoutforphoenix_kit_bucketsALTER TABLE and check column existence before ALTER - Fix settings cache race: warm synchronously in
init/1whensync_init: true; fixwarm_critical_datainserting{key, value, nil}3-tuples when TTL is nil - Fix cache
sync_initblocking supervisor for 60s when DB is overloaded - Fix startup DB timeout: defer
Dashboard.Registryinit and reorder supervisor children - Silence cache warmer spam and auto-grant warning when
role_permissionstable doesn’t exist yet - Fix
gen.migrationtask: generate UUID primary keys anduser_uuidFK instead of integer-based - Fix broken GDPR anonymization: remove leftover
user_id: nilfromupdate_allcalls - Rename
_id→_uuidacross all remaining application code: billing, shop, storage, entities, sync, emails, tickets, permissions, roles, connections, publishing, and user_notifier - Rename function names:
find_role_by_id→find_role_by_uuid,parse_id→parse_uuid,import_id→import_uuid - Fix Dialyzer warning: remove unreachable pattern match in cache warming
- Fix V56/V63 migration crash:
email_log_uuidbackfill fails withdatatype_mismatchwhenphoenix_kit_email_logs.uuidischaracter varyinginstead of nativeuuidtype - Fix UUIDFKColumns: replace broken Elixir
rescuewith PostgreSQLEXCEPTIONhandler inside DO blocks — prevents outer transaction abort on backfill failure - Add
::uuidexplicit cast in all UUIDFKColumns backfill SQL to handle varchar source columns gracefully - Fix V56: add pre-step to convert varchar
uuidcolumns on all FK source tables to nativeuuidtype beforeUUIDFKColumns.upruns - Fix V63: wrap
matched_email_log_uuidbackfill in DO block with EXCEPTION handler and::uuidcast - Add V70 migration: re-backfills
email_log_uuidandmatched_email_log_uuidfor installs where V56/V63 silently skipped the backfill; resets stale random UUIDs written by the V56 NULL-fill fallback - Add investigation doc:
dev_docs/investigations/2026-03-01-varchar-uuid-migration-bug.md
PhoenixKit 1.7.53. Install or update: {:phoenix_kit, "~> 1.7"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.