{"record":{"id":"5e7fb00e23fcab1b","repo":"flarum/framework","slug":"unsupported-database-driver","errorCode":null,"errorMessage":"Unsupported database driver","messagePattern":"Unsupported database driver","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"extensions/statistics/src/Api/Controller/ShowStatisticsData.php","lineNumber":146,"sourceCode":"        }\n\n        if (! isset($endDate)) {\n            $endDate = new DateTime();\n        }\n\n        $formats = match ($query->getConnection()->getDriverName()) {\n            'pgsql' => ['YYYY-MM-DD HH24:00:00', 'YYYY-MM-DD'],\n            default => ['%Y-%m-%d %H:00:00', '%Y-%m-%d'],\n        };\n\n        // if within the last 24 hours, group by hour\n        $format = \"CASE WHEN $column > ? THEN '$formats[0]' ELSE '$formats[1]' END\";\n\n        $dbFormattedDatetime = match ($query->getConnection()->getDriverName()) {\n            'sqlite' => \"strftime($format, $column)\",\n            'pgsql' => \"TO_CHAR($column, $format)\",\n            'mysql', 'mariadb' => \"DATE_FORMAT($column, $format)\",\n            default => throw new Exception('Unsupported database driver'),\n        };\n\n        $results = $query\n            ->selectRaw(\n                $dbFormattedDatetime.' as time_group',\n                [new DateTime('-25 hours')]\n            )\n            ->selectRaw('COUNT(id) as count')\n            ->where($column, '>', $startDate)\n            ->where($column, '<=', $endDate)\n            ->groupBy('time_group')\n            ->pluck('count', 'time_group');\n\n        $timed = [];\n\n        $results->each(function ($count, $time) use (&$timed) {\n            $time = new DateTime($time);\n            $timed[$time->getTimestamp()] = (int) $count;","sourceCodeStart":128,"sourceCodeEnd":164,"githubUrl":"https://github.com/flarum/framework/blob/4b939f685389bfe8a380e9e28ddf305a1c66950c/extensions/statistics/src/Api/Controller/ShowStatisticsData.php#L128-L164","documentation":"An exhaustiveness/compatibility error in the timed-counts query builder: getTimedCounts branches on the connection driver name (pgsql, sqlite, mysql/mariadb default). It is thrown when the database driver is none of the handled ones, so no SQL date-format expression can be generated for hourly/daily grouping.","triggerScenarios":"Thrown at extensions/statistics/src/Api/Controller/ShowStatisticsData.php:146 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run statistics on a supported driver: MySQL/MariaDB, PostgreSQL, or SQLite.","Add a match arm for the new driver with its date-formatting SQL before upgrading the database.","Catch the error and fall back to lifetime statistics if timed grouping is unavailable."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4b939f685389bfe8a380e9e28ddf305a1c66950c","analyzedAt":"2026-09-15T18:09:20.879Z","contentChangedAt":"2026-09-15T18:09:20.879Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}