from app.core.database import SessionLocal
from app.models.user import User

def cleanup_test_user():
    """清理测试用户"""
    db = SessionLocal()
    try:
        # 删除测试用户
        test_user = db.query(User).filter(User.username == "peng").first()
        if test_user:
            db.delete(test_user)
            db.commit()
            print("已删除测试用户 'peng'")
        else:
            print("未找到测试用户 'peng'")
    finally:
        db.close()

if __name__ == "__main__":
    cleanup_test_user()