Warehouse 0.5.1: Document folders can be tidied with media reorganize
Warehouse 0.5.1 lets PhoenixKit’s mix phoenix_kit.media.reorganize task tidy the file folders of warehouse documents, so folders made before a parent folder was configured can be moved under it in one go.
The task now plans moves for all six document kinds: goods receipts, goods issues, stocktakes, internal orders, supplier orders and transfers. Each live document’s folder is planned to move under the parent that the :storage_parent_folder setting names. Duplicates, copies found elsewhere, folders whose document is gone and a parent hook that fails are reported instead of guessed at. Without the :storage_parent_folder setting the task only reports and moves nothing.
A folder that a document’s form re-linked between planning and applying is left alone, so uploads into it are not stranded. Reports about folders under another parent now name that folder.
Upgrading
The reorganize task needs PhoenixKit 2.24.0 or later. Nothing changes on a site that does not run it.
Full release notes: Warehouse 0.5.1
0.5.1 · 16 September 2026
Added
- Media reorganizer plan source (#31) —
PhoenixKitWarehouse.MediaReorganizer, registered viamedia_reorganizer/0and picked up by core’smix phoenix_kit.media.reorganize(phoenix_kit ≥ 2.24.0). For all six document kinds it plans moving each live document’s folder under the:storage_parent_folderhook’s parent, back-fillingstorage_folder_uuidwhere needed, and reports duplicates, relocated stray copies, hook failures, hook-answered-root folders and orphaned legacy folders instead of guessing. No hook configured → reports only, nothing moves.StorageFolders.folder_name/3is now shared (@doc false).
Fixed
- Reorganizer pointer back-fill no longer overwrites a pointer changed
since plan time —
after_movereturns{:error, :pointer_changed}(the engine rolls the action back) when a document’sstorage_folder_uuidwas re-set between plan and apply, e.g. by a form caching a fresh folder, so uploads into that folder are never stranded. :relocatedreports name the third-party parent folder (name and uuid, one batched lookup) instead of a bare “under a different parent”.
Warehouse 0.5.1. Install or update: {:phoenix_kit_warehouse, "~> 0.5"}, then mix deps.get && mix phoenix_kit.update. Full history: CHANGELOG.