﻿# `media_files`

**Module:** Media

---

## Purpose

Tracks all uploaded files across a workspace. Stores metadata; actual files live on disk in storage/uploads/.

---

## Columns (Summary)

| Column | Notes |
|--------|-------|
| `id BIGINT UNSIGNED AUTO_INCREMENT PK` | — |
| `workspace_id BIGINT UNSIGNED NOT NULL FK→workspaces` | — |
| `original_filename VARCHAR(255) NOT NULL` | — |
| `storage_path VARCHAR(1000) NOT NULL` | — |
| `file_category VARCHAR(20) NOT NULL (profile_photo|gallery|hero|music|qr_code|export|report)` | — |
| `file_type VARCHAR(100) NOT NULL (MIME)` | — |
| `file_size INT UNSIGNED DEFAULT 0` | — |
| `processing_status VARCHAR(15) DEFAULT pending` | — |
| `uploaded_by BIGINT UNSIGNED NOT NULL FK→users` | — |
| `created_at DATETIME DEFAULT CURRENT_TIMESTAMP` | — |
| `processed_at DATETIME NULL` | — |
| `deleted_at DATETIME NULL` | — |

---

## Referenced By

media_variants(media_file_id), invitations(music_file_id)

---

## Notes

See `docs/database/RELATIONSHIP.md` for full entity relationships and `database/schema.sql` for authoritative DDL.
