{"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/bd6b5437e6ad87bb49f9b426724f07a9f64e9683/src/Illuminate/Database/Schema/Grammars/Grammar.php#L150-L186","documentation":"Base Grammar::compileVectorIndex() throws RuntimeException because the driver does not support vector indexes (pgvector-style). Only a Postgres-aware grammar with vector support overrides it. Thrown when a Blueprint vector index command is compiled on an unsupported driver.","triggerScenarios":"Calling $table->vectorIndex() / $table->vector() with an index, or any blueprint command that produces a vector-index Fluent whose compiler dispatches to Grammar::compileVectorIndex, on MySQL/SQLite/SQL Server or an incomplete custom grammar.","commonSituations":"Running a migration written for pgvector against MySQL/SQLite; CI defaulting to SQLite while migrations use vector columns/indexes.","solutions":["Switch the connection to Postgres with the pgvector extension installed.","Remove the vector index command from migrations running on unsupported drivers.","Conditionally apply vector index logic only when DB::connection() is PostgresConnection."],"exampleFix":"// before\nSchema::create('docs', function (Blueprint $t) {\n    $t->vectorIndex('embedding');\n});\n\n// after\nif (DB::connection() instanceof \\Illuminate\\Database\\PostgresConnection) {\n    Schema::create('docs', function (Blueprint $t) {\n        $t->vectorIndex('embedding');\n    });\n}","handlingStrategy":"validation","validationCode":"if (! DB::connection() instanceof \\Illuminate\\Database\\PostgresConnection) {\n    throw new \\RuntimeException('Vector indexes require Postgres + pgvector.');\n}\nSchema::create('docs', fn (Blueprint $t) => $t->vectorIndex('embedding'));","typeGuard":"function driverSupportsVectorIndex(): bool\n{\n    return DB::connection() instanceof \\Illuminate\\Database\\PostgresConnection;\n}","tryCatchPattern":"try {\n    Schema::create('docs', fn (Blueprint $t) => $t->vectorIndex('embedding'));\n} catch (\\RuntimeException $e) {\n    if (str_contains($e->getMessage(), 'vector indexes')) {\n        // skip vector index on non-Postgres\n    } else {\n        throw $e;\n    }\n}","preventionTips":["Reserve vectorIndex()/vector() for Postgres with pgvector.","Keep CI driver aligned with production for AI/embedding migrations.","Guard vector migrations with instanceof PostgresConnection."],"tags":["schema","database","driver-support","grammar","vector","postgres","indexes"],"analyzedSha":"bd6b5437e6ad87bb49f9b426724f07a9f64e9683","analyzedAt":"2026-08-06T00:28:32.783Z","schemaVersion":2}