PhoenixKit.Migrations.Postgres.V200 (phoenix_kit v2.40.1)

Copy Markdown View Source

V200: when a photo or video was taken.

Storage recorded a file's dimensions and duration at ingest but never when it was taken — no EXIF date was read, so nothing could order or group a library by it. This version adds four columns on phoenix_kit_files:

  • taken_at (timestamptz) — the moment, UTC
  • taken_on (date) — the local calendar date, which is what a library groups by
  • taken_at_offset (integer) — seconds east of UTC, when known
  • taken_at_source (varchar) — manual, exif, container, filename or inserted_at

and phoenix_kit_files_capture_date_index on (user_uuid, taken_on DESC, taken_at DESC), partial over the files a media library shows: a user's own, visible, processed images and videos. It is partial so an edited image's hidden backup and a Tessera tile pyramid — thousands of system_managed rows per image — cost the index nothing.

PhoenixKit.Modules.Storage.CaptureDate explains the columns. ProcessFileJob fills them for new uploads and Storage.Workers.CaptureDateBackfillJob for files stored earlier; nothing is backfilled here, because a date comes from a file's bytes, which a migration cannot read.

Additive only; re-runnable.

Summary

Functions

Rolls V200 back: drops the index and the four columns. Recorded dates are lost.

Functions

down(opts)

Rolls V200 back: drops the index and the four columns. Recorded dates are lost.

up(opts)