{"record":{"id":"8cc850a85daf367d","repo":"laravel/framework","slug":"this-database-driver-does-not-support-the-tsvector","errorCode":null,"errorMessage":"This database driver does not support the tsvector type.","messagePattern":"This database driver does not support the tsvector type\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Schema/Grammars/Grammar.php","lineNumber":378,"sourceCode":"     *\n     * @throws \\RuntimeException\n     */\n    protected function typeVector(Fluent $column)\n    {\n        throw new RuntimeException('This database driver does not support the vector type.');\n    }\n\n    /**\n     * Create the column definition for a tsvector type.\n     *\n     * @param  \\Illuminate\\Support\\Fluent  $column\n     * @return string\n     *\n     * @throws \\RuntimeException\n     */\n    protected function typeTsvector(Fluent $column)\n    {\n        throw new RuntimeException('This database driver does not support the tsvector type.');\n    }\n\n    /**\n     * Create the column definition for a raw column type.\n     *\n     * @param  \\Illuminate\\Support\\Fluent  $column\n     * @return string\n     */\n    protected function typeRaw(Fluent $column)\n    {\n        return $column->offsetGet('definition');\n    }\n\n    /**\n     * Add the column modifiers to the definition.\n     *\n     * @param  string  $sql\n     * @param  \\Illuminate\\Database\\Schema\\Blueprint  $blueprint","sourceCodeStart":360,"sourceCodeEnd":396,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Database/Schema/Grammars/Grammar.php#L360-L396","documentation":"The base Schema\\Grammar class declares typeTsvector() as an unconditional RuntimeException because tsvector is a PostgreSQL-specific full-text-search type. Only drivers whose grammar overrides typeTsvector() (PostgresGrammar) can emit a real SQL definition; any other driver reaching this method means the column type is unsupported on that connection.","triggerScenarios":"Calling $table->tsvector(...), $table->fulltext(...) on a tsvector column, or a migration declaring a 'tsvector' Fluent type while the default Schema connection is MySQL, SQLite, or SQL Server (any grammar that does not override typeTsvector).","commonSituations":"Copying a Postgres-oriented migration into a project that runs tests against SQLite/MySQL; using full-text search features in a multi-database app without gating the column by driver; upgrading a package that adds tsvector columns to a non-Postgres database.","solutions":["Switch the migration's connection to a Postgres connection (Schema::connection('pgsql')->create(...)) or run the app against PostgreSQL.","Gate the tsvector/fulltext column behind a driver check: if (DB::connection() instanceof \\Illuminate\\Database\\PostgresConnection) { $table->tsvector(...); }.","Replace the tsvector column with a driver-appropriate type (e.g. text plus a separate FULLTEXT index on MySQL)."],"exampleFix":"// before\n$table->tsvector('body');\n\n// after (driver-gated)\nuse Illuminate\\Support\\Facades\\DB;\n\nif (DB::connection() instanceof \\Illuminate\\Database\\PostgresConnection) {\n    $table->tsvector('body');\n} else {\n    $table->text('body');\n}","handlingStrategy":"validation","validationCode":"// before declaring the column\nuse Illuminate\\Support\\Facades\\DB;\n\nif (DB::connection()->getDriverName() !== 'pgsql') {\n    return; // or declare a non-tsvector column\n}\n\n$table->tsvector('body');","typeGuard":"function supportsTsvector(?\\Illuminate\\Database\\ConnectionInterface $c = null): bool {\n    $c ??= \\Illuminate\\Support\\Facades\\DB::connection();\n    return $c->getDriverName() === 'pgsql';\n}","tryCatchPattern":null,"preventionTips":["Gate full-text/tsvector migrations by DB::connection()->getDriverName().","Run migration tests against the same driver family used in production.","Keep Postgres-only migrations in a separate connection or migration path."],"tags":["database","schema","migrations","postgres","tsvector","driver-unsupported"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}