| import asyncio |
| import asyncpg |
| import traceback |
| from config import DB_DSN |
|
|
| async def run_debug(): |
| if not DB_DSN: |
| print("\nπ¨ CRITICAL ERROR: DB_DSN is empty!") |
| print("Your bot cannot find your PostgreSQL connection string in the .env file.") |
| return |
|
|
| print("π Connecting to PostgreSQL using your config.py...") |
| try: |
| conn = await asyncpg.connect(DB_DSN) |
| print("β
Connection successful! Reading sql/schema.sql...") |
| |
| with open("sql/schema.sql", "r") as f: |
| sql_text = f.read() |
| |
| print("π Executing schema.sql...") |
| await conn.execute(sql_text) |
| |
| print("π SUCCESS! Your tables are built.") |
| await conn.close() |
| |
| except Exception as e: |
| print("\n" + "="*50) |
| print("π¨ FULL UNCENSORED SQL ERROR π¨") |
| print("="*50) |
| traceback.print_exc() |
|
|
| asyncio.run(run_debug()) |
|
|