feat(images): add image variant pipeline fields (BE-1)#470
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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>
c4a68ab to
2de9bc9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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, defaultfalse) — gate flag, flipped totrueonly after all variants are uploaded (no half-baked images in the gallery).ready_max_width(int, default0) — ascending-generation watermark. A tier is ready iffwidth <= 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
blurhashcolumn as the placeholder (it already holds a thumbhash-encoded string consumed byhooks/use-blurhash.ts) — no duplicatethumbhashcolumn added.width/heightalready exist on the model (used for aspect-ratio placeholders → reduces CLS).image.*, so the new fields flow toImageTypeconsumers automatically;types/index.tsupdated to declare them.Test plan
prisma validate+prisma formatpass.🤖 Generated with Claude Code