Spaces:
Running
Running
| import psycopg2 | |
| import sys | |
| import os | |
| # Add parent directory to sys.path to find sovereign_memory | |
| sys.path.append(os.getcwd()) | |
| try: | |
| from sovereign_memory import DB_URL | |
| conn = psycopg2.connect(DB_URL) | |
| cur = conn.cursor() | |
| table_names = ['chat_history', 'imperial_memory_core'] | |
| for table in table_names: | |
| print(f"\n--- [taemingames.{table}] Schema ---") | |
| cur.execute(f""" | |
| SELECT column_name, data_type, is_nullable | |
| FROM information_schema.columns | |
| WHERE table_schema='taemingames' AND table_name='{table}' | |
| ORDER BY ordinal_position | |
| """) | |
| rows = cur.fetchall() | |
| for row in rows: | |
| print(f" - {row[0]:<15} : {row[1]:<15} (Nullable: {row[2]})") | |
| conn.close() | |
| print("\n✅ DB Schema verification script updated.") | |
| except Exception as e: | |
| print(f"Error: {e}") | |