diff --git a/src/backend/langflow/services/database/utils.py b/src/backend/langflow/services/database/utils.py index ce4990fa1..968cfef59 100644 --- a/src/backend/langflow/services/database/utils.py +++ b/src/backend/langflow/services/database/utils.py @@ -13,7 +13,17 @@ def initialize_database(): logger.debug("Initializing database") from langflow.services import service_manager, ServiceType - database_service = service_manager.get(ServiceType.DATABASE_SERVICE) + database_service: "DatabaseService" = service_manager.get( + ServiceType.DATABASE_SERVICE + ) + try: + database_service.create_db_and_tables() + except Exception as exc: + # if the exception involves tables already existing + # we can ignore it + if "already exists" not in str(exc): + logger.error(f"Error creating DB and tables: {exc}") + raise RuntimeError("Error creating DB and tables") from exc try: database_service.check_schema_health() except Exception as exc: @@ -39,7 +49,6 @@ def initialize_database(): if "already exists" not in str(exc): logger.error(f"Error running migrations: {exc}") raise RuntimeError("Error running migrations") from exc - database_service.create_db_and_tables() logger.debug("Database initialized") diff --git a/src/backend/langflow/services/settings/auth.py b/src/backend/langflow/services/settings/auth.py index cff671b84..7ac7461a0 100644 --- a/src/backend/langflow/services/settings/auth.py +++ b/src/backend/langflow/services/settings/auth.py @@ -34,7 +34,7 @@ class AuthSettings(BaseSettings): # If AUTO_LOGIN = True # > The application does not request login and logs in automatically as a super user. - AUTO_LOGIN: bool = False + AUTO_LOGIN: bool = True NEW_USER_IS_ACTIVE: bool = False SUPERUSER: str = DEFAULT_SUPERUSER SUPERUSER_PASSWORD: str = DEFAULT_SUPERUSER_PASSWORD