Skip to content

Entity: EventPhoto

A photo associated with an event. Each event can have multiple photos, stored in Cloudflare R2.

Fields

FieldTypeNullableDefaultDescription
idserialnoautoPrimary key
event_idintegernoFK to event.id
object_keyvarchar(512)noR2 object key (path in the bucket)
mime_typeenum(image/png, image/jpeg)noFile MIME type per ADR-008

Standard columns (created_at, updated_at, deleted_at) are inherited per ADR-007 and should not be listed here.

Relations

RelationTypeTarget entityFKOn delete
eventmany-to-oneEventevent_photo.event_idcascade

Business rules

  • The object_key is the path within the R2 bucket (e.g., events/42/photo-1.jpg).
  • The full public URL is derived at read time by prepending R2_PUBLIC_URL to the object_key.
  • When an event is deleted (soft or hard), its photos follow the same deletion path via cascade.

Notes

Storing only the object_key (not the full URL) keeps the data portable if the R2 bucket or public URL changes.