lydgs commited on
Commit
31b89fa
·
verified ·
1 Parent(s): f7eee22

Create debug_db.py

Browse files
Files changed (1) hide show
  1. scripts/debug_db.py +25 -0
scripts/debug_db.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # scripts/debug_db.py
2
+ import sqlite3
3
+ import os
4
+
5
+ DB_PATH = "/app/server/data/freeapi.db"
6
+
7
+ def debug():
8
+ if not os.path.exists(DB_PATH):
9
+ print("Database file not found!")
10
+ return
11
+ conn = sqlite3.connect(DB_PATH)
12
+ cursor = conn.cursor()
13
+ cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
14
+ tables = cursor.fetchall()
15
+ print("Tables in database:")
16
+ for (table_name,) in tables:
17
+ print(f" - {table_name}")
18
+ cursor.execute(f"PRAGMA table_info({table_name})")
19
+ columns = cursor.fetchall()
20
+ for col in columns:
21
+ print(f" {col[1]} ({col[2]})")
22
+ conn.close()
23
+
24
+ if __name__ == "__main__":
25
+ debug()