import sqlite3
from pathlib import Path

# Use the same DB path as the app (db.py)
_db_dir = Path(__file__).resolve().parent / "data"
db_path = _db_dir / "app.db"

conn = sqlite3.connect(str(db_path))
cur = conn.cursor()

print("DB:", db_path)
print("Tables:")
for row in cur.execute("select name from sqlite_master where type='table' order by name"):
    print(" -", row[0])

print("")
print("platform_posts columns:")
try:
    cols = cur.execute("pragma table_info(platform_posts)").fetchall()
    if not cols:
        print(" platform_posts exists but has no columns")
    for col in cols:
        print(col)
except Exception as e:
    print(" platform_posts does not exist:", e)

conn.close()
