import sqlite3
import os

db_path = os.path.join(os.path.dirname(__file__), 'car_platform.db')
print(f"Database path: {db_path}")
print(f"Database exists: {os.path.exists(db_path)}")
print(f"Database size: {os.path.getsize(db_path) if os.path.exists(db_path) else 0} bytes")

conn = sqlite3.connect(db_path)
cursor = conn.cursor()

# Check tables
cursor.execute("SELECT name FROM sqlite_master WHERE type='table'")
tables = cursor.fetchall()
print(f"\nTables: {[t[0] for t in tables]}")

# Check counts for each important table
table_counts = [
    'car_makers',
    'car_models',
    'cars',
    'hero_banners',
    'users',
    'translations'
]

print("\nTable counts:")
for table in table_counts:
    try:
        cursor.execute(f"SELECT COUNT(*) FROM {table}")
        count = cursor.fetchone()[0]
        print(f"  {table}: {count}")
    except Exception as e:
        print(f"  {table}: Error - {e}")

# Check if there are any car_makers
cursor.execute("SELECT * FROM car_makers LIMIT 5")
makers = cursor.fetchall()
print(f"\nSample car_makers: {makers}")

# Check if there are any hero_banners
cursor.execute("SELECT * FROM hero_banners LIMIT 5")
banners = cursor.fetchall()
print(f"\nSample hero_banners: {banners}")

conn.close()
