Files
iAs/ias-service/migrations/20260706015000_mail_polling.sql
T
wunianxiao 25dd0daa8b feat: 模块统一 ias- 前缀、独立版本与内网地址支持 (0.1.7)
- 所有 Rust crate 统一加 ias- 前缀:ai → ias-ai、common → ias-common、context → ias-context、mail → ias-mail、service → ias-service、wechat → ias-wechat
- 新增 ias-main 模块承载 CLI 入口和二进制打包
- 各模块开始独立维护版本号,ias-main 0.1.7 代表整体版本
- 新增 IA_WEB_INTERNAL_URL 环境变量,版本通知同时发送公网和内网链接
- 将已有升级日志翻译为中文
- ias_upgrade_logs 新增 modules JSONB 字段
- 新增 VERSION 文件和 CHANGELOG.md
- 新增 AGENTS.md 项目规则文件
2026-07-06 17:57:48 +08:00

49 lines
2.0 KiB
SQL

CREATE TABLE ias_mail_messages (
id BIGSERIAL PRIMARY KEY,
source_key VARCHAR(512) NOT NULL,
mailbox VARCHAR(255) NOT NULL,
uid VARCHAR(255) NOT NULL,
message_id TEXT,
from_label TEXT NOT NULL DEFAULT '',
subject TEXT NOT NULL DEFAULT '',
summary TEXT NOT NULL DEFAULT '',
content_preview TEXT NOT NULL DEFAULT '',
preview_page_id BIGINT REFERENCES ias_web_pages(id) ON DELETE SET NULL,
preview_url TEXT,
received_at TIMESTAMPTZ,
raw_size BIGINT NOT NULL DEFAULT 0,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
UNIQUE (source_key, mailbox, uid)
);
CREATE INDEX idx_ias_mail_messages_created
ON ias_mail_messages(created_at DESC);
CREATE INDEX idx_ias_mail_messages_received
ON ias_mail_messages(received_at DESC);
INSERT INTO ias_upgrade_logs (
version,
released_at,
title,
description,
changes
) VALUES (
'0.1.4',
'2026-07-06T00:00:00+08:00',
'Mail polling and standalone HTTP module',
'Added a standalone mail module for IMAP polling and notifications, moved HTTP serving and web preview pages into a standalone Rust module, and added mail persistence tables.',
'[
"Added the standalone Rust mail module for IMAP mailbox polling, message parsing, database deduplication, preview-page creation, and user notifications.",
"Added the standalone Rust ias-http module for HTTP serving, health checks, and reusable web preview pages.",
"Moved the existing web preview routes out of service and into ias-http.",
"Added /mail-api/messages and /mail-api/messages/{id} for inspecting stored mail records.",
"Added the ias_mail_messages database table and persisted the 0.1.4 upgrade record.",
"Added mail polling configuration through IA_MAIL_* environment variables; polling stays disabled when mailbox settings are absent."
]'::jsonb
) ON CONFLICT (version) DO UPDATE SET
released_at = EXCLUDED.released_at,
title = EXCLUDED.title,
description = EXCLUDED.description,
changes = EXCLUDED.changes;