"""
验证数据库表是否正确创建
"""
import sqlite3

db_path = "data/futures_analysis.db"

conn = sqlite3.connect(db_path)
cursor = conn.execute('SELECT name FROM sqlite_master WHERE type="table"')

print("✅ 数据库表列表:")
for row in cursor:
    print(f"  - {row[0]}")

# 检查 ai_analysis_cache 表是否存在
cursor.execute('SELECT name FROM sqlite_master WHERE type="table" AND name="ai_analysis_cache"')
if cursor.fetchone():
    print("\n✅ ai_analysis_cache 表已存在！")
    # 显示表结构
    cursor.execute("PRAGMA table_info(ai_analysis_cache)")
    print("\n表结构:")
    for col in cursor:
        print(f"  {col[1]} ({col[2]})")
else:
    print("\n❌ ai_analysis_cache 表不存在！")

conn.close()
