File size: 940 Bytes
732ca45
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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())