mix phoenix_kit.media.reorganize (phoenix_kit v2.29.1)

Copy Markdown View Source

Moves every module's legacy media folders to where the host's attachments_parent_folder / attachments_folder_name hooks now put new ones.

Dry-run by default — prints the report and writes nothing. --apply runs it for real, each action in its own transaction; nothing is ever hard-deleted and the run never halts on a single failure.

Usage

$ mix phoenix_kit.media.reorganize
$ mix phoenix_kit.media.reorganize --apply
$ mix phoenix_kit.media.reorganize --source catalogue --source crm
$ mix phoenix_kit.media.reorganize --pending-days 14

Options

  • --apply - Apply the planned actions (default: dry-run)
  • --source - Only plan this module key (repeatable; default: all enabled modules)
  • --pending-days - Age threshold for stale pending folders (default: 7)

Actions run as the first user with the "Owner" role (Roles.users_with_role/1, falling back to nil when there is none) — the same actor_uuid a Source's hooks would see, since the task has no interactive user of its own to attribute the run to.

Exits 1 when --apply leaves any action :failed or :conflict.