-- 016_update_checks.sql — WI-14 "update available" detection.
--
-- One row per instance: the result of the last manual update check
-- (installed buildid from the Steam ACF vs the latest buildid for the
-- instance's branch from steamcmd app_info). CHECK-ONLY bookkeeping —
-- nothing in the panel acts on this table automatically.

CREATE TABLE IF NOT EXISTS update_checks (
    instance_id       TEXT PRIMARY KEY,
    app_id            TEXT NOT NULL DEFAULT '',
    branch            TEXT NOT NULL DEFAULT '',
    installed_buildid TEXT NOT NULL DEFAULT '',
    latest_buildid    TEXT NOT NULL DEFAULT '',
    update_available  BOOLEAN NOT NULL DEFAULT FALSE,
    error             TEXT NOT NULL DEFAULT '',
    checked_at        TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
