-- ═══════════════════════════════════════════════════════════════ -- 024 FRONT PAGE: FEATURED VIDEO -- -- A fourth hero mode, 'video': a recorded video beside the words, -- the way 'livestream' puts a stream there, but without the LIVE -- badge and without autoplay: a visitor presses play. -- -- Its own two columns rather than reusing the livestream's, so a -- featured video and a stream can both be set up ahead of time and -- the mode switches between them, as photos and livestream already -- can. -- -- video_url a YouTube, Vimeo or Facebook link (turned into an -- embed), or a video file: a filename in -- public/front-page/, a /path, or an https URL ending -- in .mp4, .webm, .m4v, .mov or .ogv, which plays in -- the browser's own player -- video_title shown after "Featured video" above the headline -- -- hero_mode's CHECK can't be altered in place, so front_page is -- rebuilt. Its children (slides, sections, stats, paths) reference -- it by name; the runner has foreign keys off, so the DROP leaves -- them alone and the rename puts front_page back underneath them. -- No view or other table's trigger names front_page, so the rename -- needs no legacy_alter_table. front_page_touch goes with the old -- table and is recreated last. -- -- PRAGMA user_version; -- reads 23 before this file -- ═══════════════════════════════════════════════════════════════ CREATE TABLE front_page_new ( id TEXT PRIMARY KEY CHECK (id = 'home'), hero_mode TEXT NOT NULL DEFAULT 'brand' CHECK (hero_mode IN ('brand', 'photos', 'livestream', 'video')), eyebrow TEXT, headline TEXT NOT NULL DEFAULT 'Next Generation of Unity', subhead TEXT, primary_label TEXT, primary_url TEXT, secondary_label TEXT, secondary_url TEXT, slide_seconds INTEGER NOT NULL DEFAULT 7 CHECK (slide_seconds BETWEEN 3 AND 60), livestream_url TEXT, livestream_title TEXT, video_url TEXT, video_title TEXT, countdown_event_id TEXT REFERENCES events (id) ON DELETE SET NULL, updated_at TEXT NOT NULL DEFAULT (datetime('now')) ) STRICT; INSERT INTO front_page_new (id, hero_mode, eyebrow, headline, subhead, primary_label, primary_url, secondary_label, secondary_url, slide_seconds, livestream_url, livestream_title, countdown_event_id, updated_at) SELECT id, hero_mode, eyebrow, headline, subhead, primary_label, primary_url, secondary_label, secondary_url, slide_seconds, livestream_url, livestream_title, countdown_event_id, updated_at FROM front_page; DROP TABLE front_page; ALTER TABLE front_page_new RENAME TO front_page; CREATE TRIGGER front_page_touch AFTER UPDATE ON front_page FOR EACH ROW WHEN new.updated_at = old.updated_at BEGIN UPDATE front_page SET updated_at = datetime('now') WHERE id = new.id; END;