feat(photos): add square medium variant for sharp grid thumbnails

This commit is contained in:
iu
2026-10-11 19:57:00 +03:00
parent 581e479f03
commit f1b3b01bdf
27 changed files with 459 additions and 32 deletions
@@ -0,0 +1,11 @@
-- The grid serves a square medium variant between thumb and preview.
ALTER TABLE photo_objects DROP CONSTRAINT IF EXISTS photo_objects_role_check;
ALTER TABLE photo_objects ADD CONSTRAINT photo_objects_role_check
CHECK (role IN ('original', 'thumb', 'medium', 'preview'));
-- Regenerate variants for existing photos so they gain the medium variant and a
-- square thumb. The worker rebinds roles; superseded variants are reclaimed by
-- the reference-counting collector.
INSERT INTO variant_jobs (photo_id)
SELECT id FROM photos
ON CONFLICT (photo_id) DO NOTHING;