hero_mode answered two questions with one value, so a livestream or featured video could only ever sit on the brand backdrop. It's now two settings: Background brand | photos Beside the words nothing | livestream | featured video Any background goes with any feature: the photo slideshow can run behind the stream, with its captions, progress bars and pause button as before. The fallbacks are unchanged: photos with none added shows brand, and a feature with no link set shows nothing beside the words. Migration 025 adds hero_backdrop and hero_feature, maps each row's hero_mode onto them (photos → photos + nothing, livestream/video → brand + that feature, brand → brand + nothing) and drops hero_mode. ADD/DROP COLUMN rather than a rebuild, so front_page's children and touch trigger are untouched. The API's hero sends `backdrop` and `feature` in place of `mode`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
40 lines
2 KiB
SQL
40 lines
2 KiB
SQL
-- ═══════════════════════════════════════════════════════════════
|
|
-- 025 HERO: BACKDROP AND FEATURE ARE SEPARATE CHOICES
|
|
--
|
|
-- hero_mode answered two questions with one value: what fills the
|
|
-- background (the brand animation or the photo slideshow) and what
|
|
-- sits beside the words (nothing, a livestream or a featured
|
|
-- video). A stream or a video could only ever sit on the brand
|
|
-- backdrop. Split, any backdrop goes with any feature.
|
|
--
|
|
-- hero_backdrop 'brand' | 'photos'
|
|
-- hero_feature 'none' | 'livestream' | 'video'
|
|
--
|
|
-- Today's modes map across exactly: photos → photos + none;
|
|
-- livestream and video → brand + that feature; brand → brand +
|
|
-- none. Photos mode still falls back to brand on the page when
|
|
-- there are no photos, as before.
|
|
--
|
|
-- ADD COLUMN takes a constant DEFAULT and a CHECK, and DROP COLUMN
|
|
-- allows a column whose only constraint is its own CHECK, so no
|
|
-- rebuild: front_page's children and its touch trigger are never
|
|
-- touched.
|
|
--
|
|
-- PRAGMA user_version; -- reads 24 before this file
|
|
-- ═══════════════════════════════════════════════════════════════
|
|
|
|
ALTER TABLE front_page ADD COLUMN hero_backdrop TEXT NOT NULL DEFAULT 'brand'
|
|
CHECK (hero_backdrop IN ('brand', 'photos'));
|
|
|
|
ALTER TABLE front_page ADD COLUMN hero_feature TEXT NOT NULL DEFAULT 'none'
|
|
CHECK (hero_feature IN ('none', 'livestream', 'video'));
|
|
|
|
UPDATE front_page
|
|
SET hero_backdrop = CASE hero_mode WHEN 'photos' THEN 'photos' ELSE 'brand' END,
|
|
hero_feature = CASE hero_mode
|
|
WHEN 'livestream' THEN 'livestream'
|
|
WHEN 'video' THEN 'video'
|
|
ELSE 'none'
|
|
END;
|
|
|
|
ALTER TABLE front_page DROP COLUMN hero_mode;
|