#!/usr/bin/env python
"""Check what tables exist in the database"""
import pymysql

conn = pymysql.connect(
    host='localhost',
    user='root',
    password='password',
    database='xygbfpsg_graz',
    charset='utf8mb4'
)

try:
    with conn.cursor() as cursor:
        # Show all tables
        cursor.execute("SHOW TABLES")
        tables = cursor.fetchall()
        
        print(f"\nFound {len(tables)} tables in database:\n")
        for table in sorted(tables):
            print(f"  - {table[0]}")
        
        # Check for user-related tables
        print("\n" + "=" * 80)
        print("Looking for user-related tables:")
        print("=" * 80)
        cursor.execute("SHOW TABLES LIKE '%user%'")
        user_tables = cursor.fetchall()
        for table in user_tables:
            print(f"  ✓ {table[0]}")
            
except Exception as e:
    print(f"❌ Error: {str(e)}")
finally:
    conn.close()
