limit query

This commit is contained in:
Jörn-Michael Miehe 2022-03-28 02:03:31 +00:00
parent ce9ea61da5
commit b7179e7cfc

View file

@ -58,7 +58,7 @@ async def create_initial_admin(
raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST) raise HTTPException(status_code=status.HTTP_400_BAD_REQUEST)
with Connection.session as db: with Connection.session as db:
if db.exec(select(User)).first() is not None: if db.exec(select(User).limit(1)).first() is not None:
raise HTTPException(status_code=status.HTTP_409_CONFLICT) raise HTTPException(status_code=status.HTTP_409_CONFLICT)
# create an administrative user # create an administrative user