From 3be9c1e64691c4deef0ddf7af3e0e76ae3397f2c Mon Sep 17 00:00:00 2001 From: oudecheng <13802883547@139.com> Date: Mon, 22 Jun 2026 14:55:13 +0800 Subject: [PATCH] =?UTF-8?q?feat(storage):=20=E6=B7=BB=E5=8A=A0=20todos=20?= =?UTF-8?q?=E8=A1=A8=E7=9A=84=20created=5Fby=5Fmessage=5Fid=20=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E8=BF=81=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 检查 todos 表中是否存在 created_by_message_id 列 - 若不存在则添加该列,类型为 TEXT - 记录添加列的迁移过程日志 - 确保数据库表结构更新完成后返回成功状态 --- src/storage/mod.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/storage/mod.rs b/src/storage/mod.rs index a17e546..9637028 100644 --- a/src/storage/mod.rs +++ b/src/storage/mod.rs @@ -1977,6 +1977,17 @@ fn ensure_todos_schema(conn: &Connection) -> Result<(), StorageError> { tracing::info!("Todos table migration complete"); } + // Column migration: add created_by_message_id if it doesn't exist + let has_column = has_column(&conn, "todos", "created_by_message_id")?; + if !has_column { + tracing::info!("Adding created_by_message_id column to todos table"); + conn.execute( + "ALTER TABLE todos ADD COLUMN created_by_message_id TEXT", + [], + )?; + tracing::info!("Todos table column migration complete"); + } + Ok(()) }