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.
Limitations of this POC:
The serevr translates the type
vector(N)
toTEXT(N)
when building SQLite migrations from the Postgres schema.It doesn't validate dimensions for incoming values. So if the PG type is
vector(3)
but the client sends a vector of different dimension, this will result in a failed write to PG.Vectors are only supported in the
direct_writes
mode.To see a working example in action, navigate to
examples/web-wa-sqlite
, apply the migration and generate the client. You'll notice that the generated Zod schema for theissue
table is missing theembeddings
field. I think it's a consequence of the fact that Prisma does not support thevector
type and generates theUnsupported("vector(768)")
Prisma type for it. We can work around this by migrating off Prisma introspection and generating the Prisma schema ourselves, as shown in #872.Nevertheless, it allows you to create new issues on the client (those will have
embeddings
set toNULL
) and on the server. In the latter case,embeddings
get synced to the client database.In the screenshot below you can see the outcome of the following sequences of actions:
The
SatRelation
messages exchanged between the client and the server currently look as follows: