Files
Lark-Snooper/migrate_add_is_read.py
Benature c8658ad064 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
2026-11-08 11:31:18 +08:00

26 lines
694 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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()