import sqlite3

def inspect_db():
    conn = sqlite3.connect("cems.db")
    cursor = conn.cursor()
    
    # Get tables
    cursor.execute("SELECT name FROM sqlite_master WHERE type='table';")
    tables = [t[0] for t in cursor.fetchall()]
    print("Tables in database:", tables)
    
    # Get columns of cems_payment
    if "cems_payment" in tables:
        cursor.execute("PRAGMA table_info(cems_payment);")
        columns = cursor.fetchall()
        print("\nColumns in cems_payment table:")
        for col in columns:
            print(f"  ID: {col[0]}, Name: {col[1]}, Type: {col[2]}, Nullable: {not col[3]}, Default: {col[4]}")
            
    conn.close()

if __name__ == "__main__":
    inspect_db()
