Skip to content

Database Tables ​

MediaFlow creates five tables, all with the mediaflow_ prefix by default:

TableHolds
mediaflow_mediaOne row per file: disk, storage key, MIME type, size, dimensions, visibility, status, owner and metadata. Uses soft deletes.
mediaflow_foldersThe folder tree (parent_id, slug, path, owner_id).
mediaflow_variantsGenerated sizes per media item and preset. Deleted with their media row.
mediaflow_upload_sessionsTemporary upload sessions, cleaned by mediaflow:clean-temp.
mediaflow_settingsValues saved from the Settings page.

Changing the prefix ​

Set the prefix in .env before you run the migrations:

dotenv
# Creates mf_media, mf_folders, mf_variants, mf_upload_sessions, mf_settings
MEDIAFLOW_TABLE_PREFIX=mf_

Or override a single table:

dotenv
MEDIAFLOW_TABLE_MEDIA=media_library

The models read the table names from config, so nothing else changes. Remember to use the new name in validation rules such as Rule::exists('mf_media', 'id').

Running next to an existing media system ​

If your app already has a media table or an App\Models\Media model, for example from Spatie MediaLibrary, MediaFlow does not touch it:

  • Its models live in their own namespace, MediaFlow\Laravel\Models.
  • Its tables are prefixed, so mediaflow_media never collides with media.

Alias the model where both are used:

php
use App\Models\Media;                                  // your existing model
use MediaFlow\Laravel\Models\Media as MediaFlowMedia;  // MediaFlow

Models ​

ModelTable
MediaFlow\Laravel\Models\Mediatables.media
MediaFlow\Laravel\Models\MediaFoldertables.folders
MediaFlow\Laravel\Models\MediaVarianttables.variants
MediaFlow\Laravel\Models\UploadSessiontables.upload_sessions
MediaFlow\Laravel\Models\MediaFlowSettingtables.settings

See Media Model for helpers and relationships.

Released under the MIT License.