Backend: - expose cover thumbnail URL on album responses (LEFT JOIN + presign) - auto-assign cover only when empty; FK cover_photo_id -> photos ON DELETE SET NULL - add photos_count / members_count to album responses; cover repo test Frontend: - split layouts into (app) shell (resizable rail + contextual panel) and (public) - album rail + create-album dialog; album panel with cover picker / make-cover - photo viewer route with filmstrip, replacing lightbox; share reuses it - grid density slider, toolbar + drag-and-drop upload, dark graphite default OpenSpec: add lightroom-workspace-ui change (proposal, design, specs, tasks)
10 lines
331 B
SQL
10 lines
331 B
SQL
-- Clear any dangling cover references before adding the constraint.
|
|
UPDATE albums
|
|
SET cover_photo_id = NULL
|
|
WHERE cover_photo_id IS NOT NULL
|
|
AND cover_photo_id NOT IN (SELECT id FROM photos);
|
|
|
|
ALTER TABLE albums
|
|
ADD CONSTRAINT albums_cover_photo_fk
|
|
FOREIGN KEY (cover_photo_id) REFERENCES photos(id) ON DELETE SET NULL;
|