laravel/framework · error · RuntimeException
This database driver does not support retrieving schemas.
Error message
This database driver does not support retrieving schemas.
What it means
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.
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.
Example fix
// before - base grammar on a custom driver
Schema::connection('myengine')->getSchemas();
// after - implement in your grammar, or query directly
DB::connection('myengine')->select("SELECT schema_name FROM information_schema.schemata"); Defensive patterns
Strategy: type-guard
Validate before calling
$grammar = Schema::getConnection()->getSchemaGrammar();
if (get_class($grammar) === \Illuminate\Database\Schema\Grammars\Grammar::class) {
throw new \DomainException('Connection uses the base Grammar; compileSchemas is unsupported.');
} Type guard
function hasDriverGrammar(\Illuminate\Database\Schema\Grammars\Grammar $grammar): bool
{
return get_class($grammar) !== \Illuminate\Database\Schema\Grammars\Grammar::class;
} Try / catch
try {
Schema::getSchemas();
} catch (\RuntimeException $e) {
if (str_contains($e->getMessage(), 'retrieving schemas')) {
return DB::select('SELECT schema_name FROM information_schema.schemata');
}
throw $e;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- The database driver in use does not support vector indexes.
- This database driver does not support dropping foreign keys.
- This database driver does not support fulltext index…
- This database driver does not support fulltext index…
- This database driver does not support modifying columns.
AI-assisted analysis of laravel/framework@e0f6eb3518 (2026-08-11).
Data as JSON: /api/errors/5e3c80fa29381142.
Report an issue: GitHub.
Appendix: source
Thrown at src/Illuminate/Database/Schema/Grammars/Grammar.php:75
* @return string
*/
public function compileDropDatabaseIfExists($name)
{
return sprintf('drop database if exists %s',
$this->wrapValue($name)
);
}
/**
* Compile the query to determine the schemas.
*
* @return string
*
* @throws \RuntimeException
*/
public function compileSchemas()
{
throw new RuntimeException('This database driver does not support retrieving schemas.');
}
/**
* Compile the query to determine if the given table exists.
*
* @param string|null $schema
* @param string $table
* @return string|null
*/
public function compileTableExists($schema, $table)
{
//
}
/**
* Compile the query to determine the tables.
*
* @param string|string[]|null $schemaView on GitHub (pinned to e0f6eb3518)