Skip to main content

init_db

Initializes the database by checking for the existence of the initial superuser and creating it if it does not already exist.

def init_db(
session: Session
) - > None

Initializes the database by creating the initial superuser if it does not already exist. This ensures the system has a primary administrative account based on the configured environment settings.

Parameters

NameTypeDescription
sessionSessionThe SQLModel session object used to execute database queries and persist the new user record.

Returns

TypeDescription
NoneNothing is returned; the function performs an in-place database update.