Fix one-to-one relation for MySQL versions which do not support LIMIT parameter #4557
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.
Hello Drizzle team,
This might look like a strange fix to you, so I'm open for a discussion.
We are using Drizzle ORM for Atlassian Forge SQL (https://developer.atlassian.com/platform/forge/storage-reference/sql/) which is based on TiDB database.
With help of forge-sql-orm project we managed to make the Drizzle ORM work in our case, though we had to hack and change
mode
of query builders fromdefault
toplanetscale
.Now we faced an issue with relations. The thing is that TiDB doesn't support
LIMIT
parameters/substitutions. So basicallyLIMIT ?
throws a parse error. Therefore we have to wrap numbers intosql.raw
when we calllimit/offset
methods inselect
or passlimit/offset
to query builders.The issue is that the query builder has
1
hardcoded and we can't modify it from our code.This fix works for our case, though it's not at all elegant. Maybe a different
mode
will be needed to support Forge SQL.