-- ═══════════════════════════════════════════════════════════════ -- 033 HERO: A FEATURED EVENT -- -- A fourth hero feature, 'event': an event's card beside the -- headline, over whichever backdrop is chosen. -- -- hero_event_id the event to feature. Null means the event the -- countdown shows (its pin, or the next one that -- hasn't ended, narrowed by its scope and type), -- so the hero and the countdown can't disagree. -- A pinned event that is over, unpublished or -- deleted falls back the same way; ON DELETE SET -- NULL does the last one. -- -- hero_feature's CHECK gains 'event'. A CHECK can't be altered in -- place, so the column is replaced the way 025 did it: a new column -- with the new CHECK, the values copied across, the old one dropped -- and the new one renamed into its place. Nothing else names the -- column, so front_page itself needn't be rebuilt. -- -- PRAGMA user_version; -- reads 32 before this file -- ═══════════════════════════════════════════════════════════════ ALTER TABLE front_page ADD COLUMN hero_feature_new TEXT NOT NULL DEFAULT 'none' CHECK (hero_feature_new IN ('none', 'livestream', 'video', 'event')); UPDATE front_page SET hero_feature_new = hero_feature; ALTER TABLE front_page DROP COLUMN hero_feature; ALTER TABLE front_page RENAME COLUMN hero_feature_new TO hero_feature; ALTER TABLE front_page ADD COLUMN hero_event_id TEXT REFERENCES events (id) ON DELETE SET NULL;