-- Game Night Live — countdown timer for the scoreboard. -- One timer per event, set from the control room. Run after 0001_init.sql. -- -- State is stored so that any screen can work out the time left on its own: -- running : timer_ends_at is set (time left = timer_ends_at - now) -- paused : timer_ends_at is null, timer_remaining_ms holds what was left -- reset : timer_ends_at is null, timer_remaining_ms is null (= full duration) alter table events add column timer_visible boolean not null default false, add column timer_duration_ms int not null default 60000 check (timer_duration_ms between 1000 and 86400000), add column timer_remaining_ms int check (timer_remaining_ms >= 0), add column timer_ends_at timestamptz;