{"id":"3633cb68e9e4ba63","repo":"laravel/framework","slug":"this-database-driver-does-not-support-retrieving-f","errorCode":null,"errorMessage":"This database driver does not support retrieving foreign keys.","messagePattern":"This database driver does not support retrieving foreign keys\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Schema/Grammars/Grammar.php","lineNumber":182,"sourceCode":"     * @throws \\RuntimeException\n     */\n    public function compileVectorIndex(Blueprint $blueprint, Fluent $command)\n    {\n        throw new RuntimeException('The database driver in use does not support vector indexes.');\n    }\n\n    /**\n     * Compile the query to determine the foreign keys.\n     *\n     * @param  string|null  $schema\n     * @param  string  $table\n     * @return string\n     *\n     * @throws \\RuntimeException\n     */\n    public function compileForeignKeys($schema, $table)\n    {\n        throw new RuntimeException('This database driver does not support retrieving foreign keys.');\n    }\n\n    /**\n     * Compile a rename column command.\n     *\n     * @param  \\Illuminate\\Database\\Schema\\Blueprint  $blueprint\n     * @param  \\Illuminate\\Support\\Fluent  $command\n     * @return list<string>|string\n     */\n    public function compileRenameColumn(Blueprint $blueprint, Fluent $command)\n    {\n        return sprintf('alter table %s rename column %s to %s',\n            $this->wrapTable($blueprint),\n            $this->wrap($command->from),\n            $this->wrap($command->to)\n        );\n    }\n","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Database/Schema/Grammars/Grammar.php#L164-L200","documentation":"Base Grammar::compileForeignKeys() throws RuntimeException when the driver's grammar does not override it. It backs Schema::getForeignKeys(); first-class drivers implement it, so this is hit only with a custom/incomplete grammar.","triggerScenarios":"Calling Schema::getForeignKeys($table) on a connection whose grammar lacks the override.","commonSituations":"Custom driver not implementing compileForeignKeys; outdated community driver; wrong connection key resolved to a stub.","solutions":["Switch to a first-class driver (mysql, pgsql, sqlite, sqlsrv).","Implement compileForeignKeys($schema, $table) on the custom grammar.","Verify the connection binding in config/database.php."],"exampleFix":"// before\n$fks = Schema::connection('custom')->getForeignKeys('users');\n\n// after\npublic function compileForeignKeys($schema, $table)\n{\n    return 'select ... from information_schema.referential_constraints ...';\n}","handlingStrategy":"type-guard","validationCode":"$grammar = Schema::getConnection()->getSchemaGrammar();\nif ((new \\ReflectionMethod($grammar, 'compileForeignKeys'))->getDeclaringClass()->getName()\n    === \\Illuminate\\Database\\Schema\\Grammars\\Grammar::class) {\n    throw new \\RuntimeException('Foreign key listing unsupported on '.DB::connection()->getDriverName());\n}\nreturn Schema::getForeignKeys($table);","typeGuard":"function driverSupportsForeignKeyListing(): bool\n{\n    $g = Schema::getConnection()->getSchemaGrammar();\n\n    return (new \\ReflectionMethod($g, 'compileForeignKeys'))\n        ->getDeclaringClass()->getName() !== \\Illuminate\\Database\\Schema\\Grammars\\Grammar::class;\n}","tryCatchPattern":"try {\n    $fks = Schema::getForeignKeys($table);\n} catch (\\RuntimeException $e) {\n    $fks = [];\n}","preventionTips":["Use a first-class driver for foreign-key introspection.","Implement compileForeignKeys on custom grammars.","Verify connection bindings."],"tags":["schema","database","driver-support","grammar","foreign-keys","catalogue"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}