PhoenixKit 2.13.11: The V180 migration no longer crashes
PhoenixKit 2.13.11 fixes migration V180, which stopped every upgrade to versions 2.13.4 through 2.13.10 with LOCK TABLE can only be used in transaction blocks. Every install was affected, not only sites using the catalogue, because the table it locks always exists.
The lock, the clean-up of duplicate supplier rows and the new unique index now run together in one block, so the lock also protects the steps it was meant to. The clean-up also wrote the closing time on those rows hours off when the database session was not on UTC; it now writes the right time.
Upgrading
Upgrade straight to this version and run mix phoenix_kit.update (or mix ecto.migrate). If V180 already crashed on your install, the first half of it was saved and the version still reads V179, so a plain re-run completes it.
Full release notes: PhoenixKit 2.13.11
2.13.11 · 25 August 2026
Every install migrating through V180 crashed outright — a bare
LOCK TABLE statement outside a transaction block, 25P01 no_active_sql_transaction. Not only apps using the catalogue module: the
table V180 locks is created unconditionally by the chain (V149, and the
V135 floor), so every release from 2.13.4 through 2.13.10 is affected.
Upgrade straight to this one.
Fixed
- V180 (
enforce_one_current_supplier_per_pair/2) crashed every install withPostgrex.Error: LOCK TABLE can only be used in transaction blocks. Migration wrappers carry@disable_ddl_transaction true(core convention — every generated wrapper does this so a long DDL statement isn’t held inside one giant transaction), so each top-levelexecute/1auto-commits on its own and a bareLOCK TABLEhas no transaction to hold. Even accepted, the lock would have released at its own commit — before theUPDATEandCREATE UNIQUE INDEXit existed to protect, leaving the concurrent-writer race it was written to close still open. Lock, dedupeUPDATE, andCREATE UNIQUE INDEXnow run inside oneDO $$block, same shape V170 already used forphoenix_kit_notifications_dedupe_unseen_idx. Recovery for an install that hit the crash: block 1 of V180 (the manufacturer/supplier federation columns) already committed, and the version comment still reads'179', so a plain re-run (mix ecto.migrate/mix phoenix_kit.update) completes it — every block-1 statement isIF NOT EXISTS-guarded. - V180’s dedupe wrote
updated_atoff by the session’s UTC offset.now() AT TIME ZONE 'utc'is the right idiom for core’stimestamp without time zonecolumns, butphoenix_kit_cat_item_supplier_infodeclaresTIMESTAMPTZ(V149): the expression yields a UTC wall clock that the assignment then re-reads in the session time zone, so a host onAmerica/New_Yorkstamped the closed rows four hours in the future. Barenow()now, as V170’s dedupe already used. Only rows this migration closes were affected.
Added
- Static chain check: no
LOCK TABLEoutside aDO $$block.lock_table_guard_test.exsalready asserted that everyLOCK TABLEsits behind a table-existence guard, but it only ever looked insideDO $$bodies — a bare top-level one was invisible to it, which is how V180 shipped. Nothing else in the suite can catch this class either:PhoenixKit.Migration.Runnercarries no@disable_ddl_transaction, soensure_current/2(and thereforetest_helper.exs, and the full-chain prefix test) runs migrations inside a transaction — the one condition under which a bareLOCK TABLEsucceeds.
PhoenixKit 2.13.11. Install or update: {:phoenix_kit, "~> 2.13"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.