12 lines
570 B
SQL
12 lines
570 B
SQL
-- 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;
|