{"record":{"id":"5e3c80fa29381142","repo":"laravel/framework","slug":"this-database-driver-does-not-support-retrieving-s","errorCode":null,"errorMessage":"This database driver does not support retrieving schemas.","messagePattern":"This database driver does not support retrieving schemas\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Schema/Grammars/Grammar.php","lineNumber":75,"sourceCode":"     * @return string\n     */\n    public function compileDropDatabaseIfExists($name)\n    {\n        return sprintf('drop database if exists %s',\n            $this->wrapValue($name)\n        );\n    }\n\n    /**\n     * Compile the query to determine the schemas.\n     *\n     * @return string\n     *\n     * @throws \\RuntimeException\n     */\n    public function compileSchemas()\n    {\n        throw new RuntimeException('This database driver does not support retrieving schemas.');\n    }\n\n    /**\n     * Compile the query to determine if the given table exists.\n     *\n     * @param  string|null  $schema\n     * @param  string  $table\n     * @return string|null\n     */\n    public function compileTableExists($schema, $table)\n    {\n        //\n    }\n\n    /**\n     * Compile the query to determine the tables.\n     *\n     * @param  string|string[]|null  $schema","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Database/Schema/Grammars/Grammar.php#L57-L93","documentation":"Grammar::compileSchemas() on the base class is a RuntimeException stub - every concrete grammar (SQLite, SQL Server, Postgres, MySQL) overrides it, so reaching the base means the active connection's schema grammar is the abstract base Grammar rather than a driver-specific one. The base class intentionally refuses to guess a portable 'list schemas' query.","triggerScenarios":"Calling Schema::getConnection()->getSchemaGrammar()->compileSchemas() or any Builder method that consults schemas (e.g. getSchemas) when the connection returns a bare Illuminate\\Database\\Schema\\Grammars\\Grammar instead of a driver subclass.","commonSituations":"A custom or in-progress database driver whose Connection::getDefaultSchemaGrammar() returns new Grammar() rather than a subclass; a test double that injects the base Grammar; an incompletely-bootstrapped connection.","solutions":["Use one of the four supported drivers (sqlite, mysql, pgsql, sqlsrv), whose SchemaGrammar overrides compileSchemas.","If you maintain the driver, subclass Grammar and implement compileSchemas() with your engine's schema-listing SQL.","Replace the generic call with a direct DB::select using your engine's information_schema query."],"exampleFix":"// before - base grammar on a custom driver\nSchema::connection('myengine')->getSchemas();\n\n// after - implement in your grammar, or query directly\nDB::connection('myengine')->select(\"SELECT schema_name FROM information_schema.schemata\");","handlingStrategy":"type-guard","validationCode":"$grammar = Schema::getConnection()->getSchemaGrammar();\nif (get_class($grammar) === \\Illuminate\\Database\\Schema\\Grammars\\Grammar::class) {\n    throw new \\DomainException('Connection uses the base Grammar; compileSchemas is unsupported.');\n}","typeGuard":"function hasDriverGrammar(\\Illuminate\\Database\\Schema\\Grammars\\Grammar $grammar): bool\n{\n    return get_class($grammar) !== \\Illuminate\\Database\\Schema\\Grammars\\Grammar::class;\n}","tryCatchPattern":"try {\n    Schema::getSchemas();\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'retrieving schemas')) {\n        return DB::select('SELECT schema_name FROM information_schema.schemata');\n    }\n    throw $e;\n}","preventionTips":["Ensure every connection binds a driver-specific grammar in its Connection::getDefaultSchemaGrammar().","Use supported drivers (sqlite/mysql/pgsql/sqlsrv) for schema introspection.","In custom drivers, implement every compile* method, not just the ones you need today."],"tags":["schema","grammar","database-driver","runtime-exception"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}