chore: move photo-specific fields from pois to photos table #11

Merged
erik merged 1 commit from chore/move-photo-fields into main 2026-05-22 05:06:42 +00:00
Member

Refs: #5


Summary

  • Adds migration 0008_move_photo_fields.sql which moves took, url_original, url_optimized, url_thumbnail, width, height, and exif from pois into the photos child table (shared PK with pois). Backfills existing data and recreates affected indexes.
  • Creates a pois_full view (LEFT JOIN pois + photos) so all existing SELECT * read queries return the same column set without type changes.
  • Updates all write paths (upload pipeline, optimize-photo task, crop-photo curation handler, POI update endpoint) to write moved fields to photos.
  • Updates read queries that targeted specific photo columns on pois directly (globe.tsx, trip delete storage collection, analyze endpoint, reencode script, curation loadPhoto/loadPhotosForTrip).

Test plan

  • deno fmt --check, deno lint, deno check src/ all pass (verified locally)
  • Run just migrate up against local Supabase — migration should apply cleanly
  • Upload a new photo: confirm photos row receives url_original, took, exif, width, height; pois row has none of those columns
  • Run optimize-photo task: confirm photos.url_optimized, photos.url_thumbnail, photos.width, photos.height are set
  • Edit a photo POI's took field: confirm photos.took is updated
  • Delete a photo POI: confirm storage cleanup still collects all three paths
  • Gallery query via getTripGalleryPois: confirm ordering by took still works
Refs: #5 --- ## Summary - Adds migration `0008_move_photo_fields.sql` which moves `took`, `url_original`, `url_optimized`, `url_thumbnail`, `width`, `height`, and `exif` from `pois` into the `photos` child table (shared PK with `pois`). Backfills existing data and recreates affected indexes. - Creates a `pois_full` view (LEFT JOIN `pois` + `photos`) so all existing `SELECT *` read queries return the same column set without type changes. - Updates all write paths (upload pipeline, `optimize-photo` task, `crop-photo` curation handler, POI update endpoint) to write moved fields to `photos`. - Updates read queries that targeted specific photo columns on `pois` directly (`globe.tsx`, trip delete storage collection, analyze endpoint, reencode script, curation `loadPhoto`/`loadPhotosForTrip`). ## Test plan - [ ] `deno fmt --check`, `deno lint`, `deno check src/` all pass (verified locally) - [ ] Run `just migrate up` against local Supabase — migration should apply cleanly - [ ] Upload a new photo: confirm `photos` row receives `url_original`, `took`, `exif`, `width`, `height`; `pois` row has none of those columns - [ ] Run `optimize-photo` task: confirm `photos.url_optimized`, `photos.url_thumbnail`, `photos.width`, `photos.height` are set - [ ] Edit a photo POI's `took` field: confirm `photos.took` is updated - [ ] Delete a photo POI: confirm storage cleanup still collects all three paths - [ ] Gallery query via `getTripGalleryPois`: confirm ordering by `took` still works
chore: move photo-specific fields from pois to photos table
Some checks failed
Validate / validate (pull_request) Failing after 10s
e05e675949
Adds migration 0008 which moves took, url_original, url_optimized,
url_thumbnail, width, height, and exif out of pois and into the photos
child table (which shares its PK with pois). A pois_full view is created
to LEFT JOIN both tables, letting all existing SELECT * read queries
work without type changes. All write paths (upload, optimize-photo task,
crop-photo handler, POI update endpoint) are updated to write the moved
fields directly to photos.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
erik merged commit e3adde355c into main 2026-05-22 05:06:42 +00:00
erik deleted branch chore/move-photo-fields 2026-05-22 05:06:42 +00:00
Sign in to join this conversation.
No description provided.