Skip to content

feat(images): add image variant pipeline fields (BE-1)#470

Merged
Zheaoli merged 1 commit into
mainfrom
feat/image-variant-schema
May 30, 2026
Merged

feat(images): add image variant pipeline fields (BE-1)#470
Zheaoli merged 1 commit into
mainfrom
feat/image-variant-schema

Conversation

@Zheaoli

@Zheaoli Zheaoli commented May 30, 2026

Copy link
Copy Markdown
Collaborator

BE-1 — DB variant fields (foundational, unblocks FE-3)

Part of the image-performance overhaul (parent task #1 in #picimpact). This is the foundational schema change the rest of the pipeline + the frontend variant-consumption work depend on.

What

Adds three columns to images:

  • image_key (TEXT?) — stable content-addressed base key; all derived variant URLs are built as {baseKey}_{width}.{avif|webp}.
  • variants_ready (bool, default false) — gate flag, flipped to true only after all variants are uploaded (no half-baked images in the gallery).
  • ready_max_width (int, default 0) — ascending-generation watermark. A tier is ready iff width <= ready_max_width, so the frontend can render partial backfill state (soft-but-never-broken) without 404s.

Adds index (variants_ready, del) to support the backfill queue scan (WHERE variants_ready = false AND del = 0).

Notes

  • Reuses the existing blurhash column as the placeholder (it already holds a thumbhash-encoded string consumed by hooks/use-blurhash.ts) — no duplicate thumbhash column added.
  • width/height already exist on the model (used for aspect-ratio placeholders → reduces CLS).
  • Gallery queries select image.*, so the new fields flow to ImageType consumers automatically; types/index.ts updated to declare them.

Test plan

  • prisma validate + prisma format pass.
  • Migration is additive only (new nullable/defaulted columns + index) — safe on existing data, no backfill required at migrate time.

🤖 Generated with Claude Code

@vercel

vercel Bot commented May 30, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
picimpact Ready Ready Preview, Comment May 30, 2026 11:15am

Add columns to support the image preprocessing pipeline (BE-1):
- image_key: stable content-addressed base key for derived variants
- variants_ready: gate flag, true only after all variants are uploaded
- ready_max_width: ascending-generation watermark; a tier is ready iff
  its width <= ready_max_width (lets the frontend render partial backfill
  state without 404s)

Reuses the existing blurhash column as the placeholder (no duplicate
thumbhash column). Adds an index on (variants_ready, del) to support the
backfill queue scan. Gallery queries select image.* so the new fields are
exposed to ImageType consumers automatically.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Zheaoli Zheaoli force-pushed the feat/image-variant-schema branch from c4a68ab to 2de9bc9 Compare May 30, 2026 11:12
@Zheaoli Zheaoli merged commit 4370773 into main May 30, 2026
5 of 6 checks passed
@Zheaoli Zheaoli deleted the feat/image-variant-schema branch May 30, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant