Repository navigation
Support VECTOR columns and indexes - #38
Merged
Merged
Conversation
MariaDB 11.7+ and MySQL 9 have a VECTOR(n) column type, and MariaDB adds VECTOR KEY indexes on them. Laravel's $table->vector() emits the column (and ->index() the MariaDB index), so both show up in schema dumps, and the parser rejected the whole dump with 'Unsupported field type'. VECTOR INDEX/KEY is only merged at the start of a table element, not in the lexer, so `vector` keeps working as an identifier elsewhere.
Owner
|
Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MariaDB 11.7+ and MySQL 9 have a
VECTOR(n)column type. Laravel's$table->vector('embedding', 1536)writes it, and on MariaDB->index()adds a vector index, so both end up inschema:dumpoutput:The parser throws
Unsupported field type: VECTORon the column, andUnsupported field type: KEYon the index once the column type is known. Larastan reads Laravel schema dumps with this parser and skips the whole file when it throws, so models of unrelated tables end up with missing-property errors (larastan/larastan#2665).VECTORandVECTOR(n)now go through the same length handling asBINARY(n), so the dimensions land inlength.VECTOR INDEXandVECTOR KEYare parsed likeSPATIAL INDEX/SPATIAL KEYwith typeVECTOR, and options likeMandDISTANCEstay inmore. That pair is only merged at the start of a table element rather than in the lexer, sovectorstill works as a plain identifier, e.g.DEFAULT vector KEYon older MariaDB.Fixes #37