INSERT INTO ias_upgrade_logs (
    version,
    released_at,
    title,
    description,
    changes,
    modules
) VALUES (
    '0.1.9',
    '2026-07-06T00:00:00+08:00',
    '邮件最近 20 封未读检查',
    '调整邮件轮询策略，每轮读取邮箱最近 20 封邮件并基于 FLAGS 判断未读状态，仅对未读且未入库的邮件生成预览页并发送提醒。',
    '[
        "调整邮件轮询逻辑：每轮固定读取邮箱最近 20 封邮件，而不是仅搜索 UNSEEN 集合。",
        "读取最近邮件时同步获取 FLAGS，只对未包含 \\Seen 标记的邮件入库、生成预览页并发送微信提醒。",
        "邮件正文抓取改用 BODY.PEEK[]，避免检查最近邮件时把未读邮件隐式标记为已读。",
        "新增最近 20 封 sequence range 的单元测试，并通过 cargo test -p ias-mail 与 cargo check 验证。",
        "无数据库结构变化。"
    ]'::jsonb,
    '{
        "ias-common": "0.1.0",
        "ias-ai": "0.1.0",
        "ias-wechat": "0.1.0",
        "ias-context": "0.1.0",
        "ias-http": "0.1.0",
        "ias-mail": "0.1.2",
        "ias-service": "0.1.0",
        "ias-main": "0.1.9"
    }'::jsonb
) ON CONFLICT (version) DO UPDATE SET
    released_at = EXCLUDED.released_at,
    title = EXCLUDED.title,
    description = EXCLUDED.description,
    changes = EXCLUDED.changes,
    modules = EXCLUDED.modules;
