-- 028_speedtest_metrics.sql -- Enrich speedtest results with the full Ookla metric set + a generic settings -- store (reused by the speedtest schedule and, later, theming). ALTER TABLE speedtest_results ALTER COLUMN down_mbps DROP NOT NULL; ALTER TABLE speedtest_results ALTER COLUMN up_mbps DROP NOT NULL; ALTER TABLE speedtest_results ADD COLUMN IF NOT EXISTS jitter_ms numeric, ADD COLUMN IF NOT EXISTS packet_loss numeric, ADD COLUMN IF NOT EXISTS server_name text, ADD COLUMN IF NOT EXISTS server_id text, ADD COLUMN IF NOT EXISTS isp text, ADD COLUMN IF NOT EXISTS result_url text, ADD COLUMN IF NOT EXISTS down_bytes bigint, ADD COLUMN IF NOT EXISTS up_bytes bigint, ADD COLUMN IF NOT EXISTS ok boolean NOT NULL DEFAULT true, ADD COLUMN IF NOT EXISTS error text; CREATE TABLE IF NOT EXISTS app_settings ( key text PRIMARY KEY, value jsonb NOT NULL DEFAULT '{}'::jsonb, updated_at timestamptz NOT NULL DEFAULT now() );