feat: 历史同步优化与消息已读属性
- 历史同步: 本地缓存优先、断点续传、按月批量同步 - 新增 sync_monthly.py: 支持逐月往前推进同步 - 消息表新增 is_read 字段,默认 false - Obsidian 文档 frontmatter 自动补充 is_read: false - 新增 migrate_add_is_read.py / migrate_obsidian_is_read.py 迁移脚本 - 总结 prompt 补充: 不记录腾讯会议号 - 历史同步失败时记录日志到 ~/.larkx/logs/history-failures.jsonl
This commit is contained in:
25
migrate_add_is_read.py
Normal file
25
migrate_add_is_read.py
Normal file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env python3
|
||||
"""给 messages 表添加 is_read 字段(默认 false)。"""
|
||||
|
||||
import os
|
||||
import sqlite3
|
||||
|
||||
|
||||
def main():
|
||||
db_path = os.path.expanduser("~/.larkx/messages.db")
|
||||
conn = sqlite3.connect(db_path)
|
||||
try:
|
||||
cursor = conn.execute("PRAGMA table_info(messages)")
|
||||
columns = {row[1] for row in cursor.fetchall()}
|
||||
if "is_read" in columns:
|
||||
print("is_read 字段已存在,无需迁移")
|
||||
return
|
||||
conn.execute("ALTER TABLE messages ADD COLUMN is_read BOOLEAN DEFAULT 0")
|
||||
conn.commit()
|
||||
print("已添加 is_read 字段,默认 false")
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user