import asyncio import sys from pathlib import Path # Add backend directory to sys.path BACKEND_ROOT = Path(__file__).resolve().parents[2] sys.path.insert(0, str(BACKEND_ROOT)) from app.core.database import AsyncSessionLocal from app.models.user import User from sqlalchemy import select, func async def check_users(): async with AsyncSessionLocal() as session: result = await session.execute(select(func.count(User.id))) count = result.scalar() print(f"User count: {count}") if count > 0: result = await session.execute(select(User.username, User.role).limit(5)) users = result.fetchall() print("Existing users:") for u in users: print(f"- {u.username} ({u.role})") if __name__ == "__main__": asyncio.run(check_users())