{"record":{"id":"d3067d8d23cd50d1","repo":"laravel/framework","slug":"schema-dumping-is-not-supported-when-using-sql-ser","errorCode":null,"errorMessage":"Schema dumping is not supported when using SQL Server.","messagePattern":"Schema dumping is not supported when using SQL Server\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/SqlServerConnection.php","lineNumber":154,"sourceCode":"     *\n     * @return \\Illuminate\\Database\\Schema\\Grammars\\SqlServerGrammar\n     */\n    protected function getDefaultSchemaGrammar()\n    {\n        return new SchemaGrammar($this);\n    }\n\n    /**\n     * Get the schema state for the connection.\n     *\n     * @param  \\Illuminate\\Filesystem\\Filesystem|null  $files\n     * @param  callable|null  $processFactory\n     *\n     * @throws \\RuntimeException\n     */\n    public function getSchemaState(?Filesystem $files = null, ?callable $processFactory = null)\n    {\n        throw new RuntimeException('Schema dumping is not supported when using SQL Server.');\n    }\n\n    /**\n     * Get the default post processor instance.\n     *\n     * @return \\Illuminate\\Database\\Query\\Processors\\SqlServerProcessor\n     */\n    protected function getDefaultPostProcessor()\n    {\n        return new SqlServerProcessor;\n    }\n}\n","sourceCodeStart":136,"sourceCodeEnd":167,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Database/SqlServerConnection.php#L136-L167","documentation":"SqlServerConnection::getSchemaState overrides the base connection and unconditionally throws RuntimeException. Laravel ships no SqlServerSchemaState implementation, so schema:dump and the structure-migration tooling that depends on getSchemaState() cannot operate on a SQL Server connection. The intent is to fail loudly rather than emit a partial or incorrect dump.","triggerScenarios":"Running php artisan schema:dump (or any code path that calls $connection->getSchemaState()) while the default DB connection (or the one targeted by the command) uses the 'sqlsrv' driver.","commonSituations":"Mixing SQL Server with the migrate:fresh --seed workflow that auto-dumps schema; CI pipelines that run schema:dump against every configured connection; copying a workflow from a MySQL project into a SQL Server project.","solutions":["Do not invoke schema:dump against SQL Server; remove it from your migration/CI workflow for the sqlsrv connection.","Use SQL Server's own tooling (sqlpackage / generate-scripts in SSMS) to capture schema, then commit the .sql file and load it via migrations or a custom command.","If you need parallel schema-state hooks, branch the command by driver and only call schema:dump for connections that support it."],"exampleFix":"// before (always dumps, fails on sqlsrv)\nArtisan::call('schema:dump');\n\n// after (driver-guarded)\nuse Illuminate\\Support\\Facades\\DB;\n\nif (DB::connection()->getDriverName() !== 'sqlsrv') {\n    Artisan::call('schema:dump');\n}","handlingStrategy":"validation","validationCode":"use Illuminate\\Support\\Facades\\DB;\n\nif (DB::connection()->getDriverName() !== 'sqlsrv') {\n    Artisan::call('schema:dump');\n}","typeGuard":"function supportsSchemaState(?\\Illuminate\\Database\\ConnectionInterface $c = null): bool {\n    $c ??= \\Illuminate\\Support\\Facades\\DB::connection();\n    return ! $c instanceof \\Illuminate\\Database\\SqlServerConnection;\n}","tryCatchPattern":null,"preventionTips":["Exclude SQL Server connections from schema:dump workflows.","Use sqlpackage / SSMS scripts for SQL Server schema capture.","Branch schema tooling by driver in shared artisan commands."],"tags":["database","sql-server","schema-dump","driver-unsupported","artisan"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}