mix phx_media_library.doctor (PhxMediaLibrary v0.6.1)

Copy Markdown View Source

Runs health checks on the media library and reports issues.

Performs four checks:

  1. File existence — verifies every local-disk media file is present on disk (skipped for remote adapters such as S3).
  2. Broken conversions — verifies that every recorded conversion file exists on disk.
  3. Orphaned records — detects media records whose parent model no longer exists in the database (uses PhxMediaLibrary.ModelRegistry).
  4. Soft-delete backlog — warns when there are trashed records older than 30 days (only when soft-deletes are enabled).

Usage

$ mix phx_media_library.doctor

Options

--skip-files    Skip file existence and broken-conversion checks
--skip-orphans  Skip orphaned record detection
--fix           Permanently delete broken/missing media (with prompt)

Examples

# Full health check
$ mix phx_media_library.doctor

# Skip file checks (useful when files are on S3)
$ mix phx_media_library.doctor --skip-files

# Automatically clean up broken media after confirmation
$ mix phx_media_library.doctor --fix