diff --git a/allianceauth/checks.py b/allianceauth/checks.py index 82ee858c..057efd36 100644 --- a/allianceauth/checks.py +++ b/allianceauth/checks.py @@ -140,11 +140,19 @@ def sql_settings(app_configs, **kwargs) -> List[CheckMessage]: errors: List[CheckMessage] = [] for connection in db.connections.all(): if connection.vendor == "mysql": - if connection.settings_dict["OPTIONS"]["charset"] != "utf8mb4": - errors.append(Error("SQL Charset is not set correctly", hint="https://gitlab.com/allianceauth/allianceauth/-/commit/89be2456fb2d741b86417e889da9b6129525bec8", id="allianceauth.checks.B001")) + try: + if connection.settings_dict["OPTIONS"]["charset"] != "utf8mb4": + errors.append(Error(f"SQL Charset is not set to utf8mb4 DB:{connection.alias}", hint="https://gitlab.com/allianceauth/allianceauth/-/commit/89be2456fb2d741b86417e889da9b6129525bec8", id="allianceauth.checks.B001")) + except KeyError: + errors.append(Error(f"SQL Charset is not set to utf8mb4 DB:{connection.alias}", hint="https://gitlab.com/allianceauth/allianceauth/-/commit/89be2456fb2d741b86417e889da9b6129525bec8", id="allianceauth.checks.B001")) + # This hasn't actually been set on AA yet - # if connection.settings_dict["OPTIONS"]["charset"] != "utf8mb4_unicode_ci": - # errors.append(Error("SQL Collation is not set correctly", hint="", id="allianceauth.checks.B002")) + # try: + # if connection.settings_dict["OPTIONS"]["collation"] != "utf8mb4_unicode_ci": + # errors.append(Error(f"SQL Collation is not set to utf8mb4_unicode_ci DB:{connection.alias}", hint="https://gitlab.com/allianceauth/allianceauth/-/commit/89be2456fb2d741b86417e889da9b6129525bec8", id="allianceauth.checks.B001")) + # except KeyError: + # errors.append(Error(f"SQL Collation is not set to utf8mb4_unicode_ci DB:{connection.alias}", hint="https://gitlab.com/allianceauth/allianceauth/-/commit/89be2456fb2d741b86417e889da9b6129525bec8", id="allianceauth.checks.B001")) + # if connection.vendor == "sqlite": return errors