laravel/framework · error · RuntimeException
This database driver does not support the tsvector type.
Error message
This database driver does not support the tsvector type.
What it means
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.
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).
Example fix
// before
$table->tsvector('body');
// after (driver-gated)
use Illuminate\Support\Facades\DB;
if (DB::connection() instanceof \Illuminate\Database\PostgresConnection) {
$table->tsvector('body');
} else {
$table->text('body');
} Defensive patterns
Strategy: validation
Validate before calling
// before declaring the column
use Illuminate\Support\Facades\DB;
if (DB::connection()->getDriverName() !== 'pgsql') {
return; // or declare a non-tsvector column
}
$table->tsvector('body'); Type guard
function supportsTsvector(?\Illuminate\Database\ConnectionInterface $c = null): bool {
$c ??= \Illuminate\Support\Facades\DB::connection();
return $c->getDriverName() === 'pgsql';
} Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- This database driver does not support modifying generated…
- SQLite does not support altering primary keys.
- The database driver in use does not support spatial indexes.
- This database driver does not support dropping foreign keys…
- This database driver requires a type, see the virtualAs /…
AI-assisted analysis of laravel/framework@e0f6eb3518 (2026-08-11).
Data as JSON: /api/errors/8cc850a85daf367d.
Report an issue: GitHub.
Appendix: source
Thrown at src/Illuminate/Database/Schema/Grammars/Grammar.php:378
*
* @throws \RuntimeException
*/
protected function typeVector(Fluent $column)
{
throw new RuntimeException('This database driver does not support the vector type.');
}
/**
* Create the column definition for a tsvector type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
*
* @throws \RuntimeException
*/
protected function typeTsvector(Fluent $column)
{
throw new RuntimeException('This database driver does not support the tsvector type.');
}
/**
* Create the column definition for a raw column type.
*
* @param \Illuminate\Support\Fluent $column
* @return string
*/
protected function typeRaw(Fluent $column)
{
return $column->offsetGet('definition');
}
/**
* Add the column modifiers to the definition.
*
* @param string $sql
* @param \Illuminate\Database\Schema\Blueprint $blueprintView on GitHub (pinned to e0f6eb3518)