feat(storage): 添加 todos 表的 created_by_message_id 字段迁移

- 检查 todos 表中是否存在 created_by_message_id 列
- 若不存在则添加该列,类型为 TEXT
- 记录添加列的迁移过程日志
- 确保数据库表结构更新完成后返回成功状态
This commit is contained in:
oudecheng 2026-06-22 14:55:13 +08:00
parent 4efc8b51e7
commit 3be9c1e646

View File

@ -1977,6 +1977,17 @@ fn ensure_todos_schema(conn: &Connection) -> Result<(), StorageError> {
tracing::info!("Todos table migration complete"); 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(()) Ok(())
} }