{"id":"4ce65fdbd831d673","repo":"laravel/framework","slug":"this-database-driver-does-not-support-the-vector-t","errorCode":null,"errorMessage":"This database driver does not support the vector type.","messagePattern":"This database driver does not support the vector type\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Schema/Grammars/Grammar.php","lineNumber":365,"sourceCode":"     *\n     * @throws \\RuntimeException\n     */\n    protected function typeComputed(Fluent $column)\n    {\n        throw new RuntimeException('This database driver does not support the computed type.');\n    }\n\n    /**\n     * Create the column definition for a vector type.\n     *\n     * @param  \\Illuminate\\Support\\Fluent  $column\n     * @return string\n     *\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     *","sourceCodeStart":347,"sourceCodeEnd":383,"githubUrl":"https://github.com/laravel/framework/blob/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Database/Schema/Grammars/Grammar.php#L347-L383","documentation":"Base Grammar::typeVector() throws RuntimeException because the driver's grammar does not support the 'vector' column type. typeVector is dispatched by getType() when a Blueprint declares $table->vector($dimensions). Only a Postgres-aware grammar with pgvector support overrides it; other drivers do not ship vector storage.","triggerScenarios":"Declaring $table->vector('embedding', 1536) in a migration on MySQL, SQLite, or SQL Server, or any driver whose grammar does not override typeVector.","commonSituations":"Running AI/embedding migrations written for pgvector against a non-Postgres DB; CI defaulting to SQLite while the app uses vector columns.","solutions":["Switch to Postgres with the pgvector extension installed.","Remove the vector() column on unsupported drivers, or store embeddings in a JSON/blob column instead.","Conditionally create the column based on the driver/connection type."],"exampleFix":"// before\nSchema::create('embeddings', function (Blueprint $t) {\n    $t->vector('embedding', 1536);\n});\n\n// after\nif (DB::connection() instanceof \\Illuminate\\Database\\PostgresConnection) {\n    Schema::create('embeddings', function (Blueprint $t) {\n        $t->vector('embedding', 1536);\n    });\n} else {\n    Schema::create('embeddings', function (Blueprint $t) {\n        $t->json('embedding'); // fallback storage\n    });\n}","handlingStrategy":"validation","validationCode":"if (! DB::connection() instanceof \\Illuminate\\Database\\PostgresConnection) {\n    throw new \\RuntimeException('Vector columns require Postgres + pgvector.');\n}\nSchema::create('embeddings', fn (Blueprint $t) => $t->vector('embedding', 1536));","typeGuard":"function driverSupportsVectorType(): bool\n{\n    return DB::connection() instanceof \\Illuminate\\Database\\PostgresConnection;\n}","tryCatchPattern":"try {\n    Schema::create('embeddings', fn (Blueprint $t) => $t->vector('embedding', 1536));\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'vector type')) {\n        Schema::create('embeddings', fn (Blueprint $t) => $t->json('embedding'));\n    } else {\n        throw $e;\n    }\n}","preventionTips":["Reserve vector() for Postgres with pgvector.","Keep CI driver aligned with production for AI/embedding migrations.","Use JSON/blob fallback storage on non-Postgres drivers.","Guard vector migrations with instanceof PostgresConnection."],"tags":["schema","database","driver-support","grammar","columns","vector","postgres","pgvector","migrations"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}