{"record":{"id":"804efb5a65e6cd63","repo":"laravel/framework","slug":"the-database-driver-in-use-does-not-support-vector","errorCode":null,"errorMessage":"The database driver in use does not support vector indexes.","messagePattern":"The database driver in use does not support vector indexes\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Illuminate/Database/Schema/Grammars/Grammar.php","lineNumber":168,"sourceCode":"     * @throws \\RuntimeException\n     */\n    public function compileIndexes($schema, $table)\n    {\n        throw new RuntimeException('This database driver does not support retrieving indexes.');\n    }\n\n    /**\n     * Compile a vector index key command.\n     *\n     * @param  \\Illuminate\\Database\\Schema\\Blueprint  $blueprint\n     * @param  \\Illuminate\\Support\\Fluent  $command\n     * @return void\n     *\n     * @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.","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/laravel/framework/blob/e0f6eb3518ac29fbbca8529e97d0df7fc9f24481/src/Illuminate/Database/Schema/Grammars/Grammar.php#L150-L186","documentation":"Grammar::compileVectorIndex() throws RuntimeException on the base; only PostgresGrammar and MariaDbGrammar override it (Maria via its own override, MySQL/Maria vector support; SQLite and SQL Server do not). The throw fires from Blueprint when a vectorIndex() command is built against a grammar that cannot compile it.","triggerScenarios":"Defining $table->vector('embedding', 1536)->vectorIndex() (or any command that issues a vector index key) in a migration running on plain MySQL, SQLite, or SQL Server.","commonSituations":"Running migrations originally written for Postgres+pgvector on a SQLite test database; shipping a vector search feature on an engine that lacks vector index support; Maria vs plain MySQL mismatch (MariaDB supports, plain MySQL does not).","solutions":["Run vector-index migrations only on Postgres (preferred) or MariaDB.","In tests, skip or stub the vector-index migration when the connection is SQLite.","If you must store vectors on an unsupported engine, drop vectorIndex() and manage indexing in application code or use a dedicated vector store."],"exampleFix":"// before - runs on SQLite in tests and throws\nSchema::create('documents', function (Blueprint $t) {\n    $t->vector('embedding', 1536)->vectorIndex();\n});\n\n// after - gate by driver\nSchema::create('documents', function (Blueprint $t) {\n    $col = $t->vector('embedding', 1536);\n    if (in_array(config('database.default'), ['pgsql', 'mariadb'])) {\n        $col->vectorIndex();\n    }\n});","handlingStrategy":"validation","validationCode":"use Illuminate\\Database\\PostgresConnection;\nuse Illuminate\\Database\\MariaDbConnection;\n\n$conn = Schema::getConnection();\n$supportsVectorIndex = $conn instanceof PostgresConnection\n    || $conn instanceof MariaDbConnection;\n\nif (! $supportsVectorIndex) {\n    throw new \\DomainException('Vector indexes require Postgres or MariaDB.');\n}","typeGuard":"use Illuminate\\Database\\PostgresConnection;\nuse Illuminate\\Database\\MariaDbConnection;\n\nfunction supportsVectorIndex(\\Illuminate\\Database\\Connection $connection): bool\n{\n    return $connection instanceof PostgresConnection\n        || $connection instanceof MariaDbConnection;\n}","tryCatchPattern":"try {\n    Schema::create('docs', fn ($t) => $t->vector('embedding', 1536)->vectorIndex());\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'vector indexes')) {\n        Schema::create('docs', fn ($t) => $t->vector('embedding', 1536));\n    } else {\n        throw $e;\n    }\n}","preventionTips":["Run vector-index migrations on Postgres (or MariaDB) only.","In tests, skip or stub vector-index creation on SQLite.","Keep engine-specific schema features behind a driver check in shared migrations."],"tags":["schema","grammar","vector","database-driver","postgres","mariadb","runtime-exception"],"backgroundTag":null,"analyzedSha":"e0f6eb3518ac29fbbca8529e97d0df7fc9f24481","analyzedAt":"2026-08-11T20:52:37.562Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}