laravel/framework · error · RuntimeException
Schema dumping is not supported when using SQL Server.
Error message
Schema dumping is not supported when using SQL Server.
What it means
SqlServerConnection.getSchemaState() unconditionally throws RuntimeException because SQL Server has no native schema-dump integration in Laravel (no equivalent of mysqldump/pg_dump wired into SqlServerSchemaState). Calling schema:dump or any code path that requests a connection's schema state on SQL Server hits this hard block.
Source
Thrown at src/Illuminate/Database/SqlServerConnection.php:154
*
* @return \Illuminate\Database\Schema\Grammars\SqlServerGrammar
*/
protected function getDefaultSchemaGrammar()
{
return new SchemaGrammar($this);
}
/**
* Get the schema state for the connection.
*
* @param \Illuminate\Filesystem\Filesystem|null $files
* @param callable|null $processFactory
*
* @throws \RuntimeException
*/
public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null)
{
throw new RuntimeException('Schema dumping is not supported when using SQL Server.');
}
/**
* Get the default post processor instance.
*
* @return \Illuminate\Database\Query\Processors\SqlServerProcessor
*/
protected function getDefaultPostProcessor()
{
return new SqlServerProcessor;
}
}
View on GitHub (pinned to bd6b5437e6)
Solutions
- Do not run schema:dump on SQL Server — remove/skip that step in CI and scripts.
- Use SQL Server's own tooling (sqlpackage / bcp / SSMS) for schema export/import instead.
- Verify DB_CONNECTION is what you intend; if you expected MySQL/Postgres, fix the env.
- Gate the schema:dump call behind a driver check: if (DB::getDriverName() !== 'sqlsrv') Artisan::call('schema:dump').
Example fix
// before
Artisan::call('schema:dump');
// after
if (DB::getDriverName() !== 'sqlsrv') {
Artisan::call('schema:dump');
} Defensive patterns
Strategy: validation
Validate before calling
if (DB::getDriverName() !== 'sqlsrv') {
Artisan::call('schema:dump');
} Type guard
function supportsSchemaDump(): bool
{
return DB::getDriverName() !== 'sqlsrv';
} Prevention
- Never call schema:dump on SQL Server — use sqlpackage/SSMS instead.
- Driver-guard any CI step that dumps schemas.
- Document that SQL Server is unsupported for schema:dump in project README.
When it happens
Trigger: Running php artisan schema:dump against a SQL Server (DB_CONNECTION=sqlsrv) connection; a test/CI step that programmatically calls $connection->getSchemaState(); migrating from MySQL/Postgres to SQL Server without removing the schema-dump workflow.
Common situations: Apps migrated to SQL Server where schema:dump was part of CI; packages that assume schema dumping works on all drivers; misconfigured DB_CONNECTION env var.
Related errors
- Using three-part references is not supported, you may use `S
- Dump execution exceeded maximum depth of 30.
- The chunkById operation was aborted because the [{$alias}] c
- The chunk size should be at least 1
- The lazyById operation was aborted because the [{$alias}] co
AI-assisted analysis of laravel/framework@bd6b5437e6 (2026-08-06).
Data as JSON: /data/errors/d3067d8d23cd50d1.json.
Report an issue: GitHub.