CREATE TABLE ias_version_notifications (
    version VARCHAR(64) PRIMARY KEY,
    notified_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
    recipient_count INTEGER NOT NULL DEFAULT 0
);

INSERT INTO ias_upgrade_logs (
    version,
    released_at,
    title,
    description,
    changes
) VALUES (
    '0.1.6',
    '2026-07-06T00:00:00+08:00',
    'Version update notifications and changelog pages',
    'Added HTTP upgrade-log pages and one-time startup notifications that tell users which version the service updated to.',
    '[
        "Added HTTP-rendered upgrade log pages at /updates and /updates/{version}.",
        "Added one-time startup notifications for new service versions, including the updated version number and an HTTP upgrade-log link.",
        "Added persisted version notification state so users are not notified repeatedly after ordinary restarts.",
        "Persisted the 0.1.6 upgrade record."
    ]'::jsonb
) ON CONFLICT (version) DO UPDATE SET
    released_at = EXCLUDED.released_at,
    title = EXCLUDED.title,
    description = EXCLUDED.description,
    changes = EXCLUDED.changes;
