Skip to content

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.doctor diagnostic command — detects migration version vs schema_migrations discrepancies, stale COMMENT tags, and common DB issues
  • Add update_mode to mix 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.migrate in-process instead of System.cmd for 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_timeout for phoenix_kit_buckets ALTER TABLE and check column existence before ALTER
  • Fix settings cache race: warm synchronously in init/1 when sync_init: true; fix warm_critical_data inserting {key, value, nil} 3-tuples when TTL is nil
  • Fix cache sync_init blocking supervisor for 60s when DB is overloaded
  • Fix startup DB timeout: defer Dashboard.Registry init and reorder supervisor children
  • Silence cache warmer spam and auto-grant warning when role_permissions table doesn’t exist yet
  • Fix gen.migration task: generate UUID primary keys and user_uuid FK instead of integer-based
  • Fix broken GDPR anonymization: remove leftover user_id: nil from update_all calls
  • Rename _id → _uuid across 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_uuid backfill fails with datatype_mismatch when phoenix_kit_email_logs.uuid is character varying instead of native uuid type
  • Fix UUIDFKColumns: replace broken Elixir rescue with PostgreSQL EXCEPTION handler inside DO blocks — prevents outer transaction abort on backfill failure
  • Add ::uuid explicit cast in all UUIDFKColumns backfill SQL to handle varchar source columns gracefully
  • Fix V56: add pre-step to convert varchar uuid columns on all FK source tables to native uuid type before UUIDFKColumns.up runs
  • Fix V63: wrap matched_email_log_uuid backfill in DO block with EXCEPTION handler and ::uuid cast
  • Add V70 migration: re-backfills email_log_uuid and matched_email_log_uuid for 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.