-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MySQL insertId
is undefined after executeTakeFirstOrThrow()
#1049
Comments
Closed, likely a duplicate to #316 :
Also, the docs state:
Still a little bummer that the original query has to be split up into two, but oh well... |
Those are not our limitations but MySQL's. Feel free to take this up to MySQL. |
Not sure if I understand the workings under the hood, but I do get a insertId when using mysql2, so maybe not a MySQL limitation This is the response from mysql2:
And in Kysley, I get this:
The docs mention this:
In my case, there is
So maybe not an issue with MySQL, something else |
@heethjain21, Did you managed to find a workaround? |
No. I was thinking of creating a PR to fix this, but haven't gotten time yet. @koskimas could you please point me in the direction where I should be looking to fix this problem? Referring to this comment: #1049 (comment) I'll start once I manage to get some time. |
We have tests. This works. Provide a reproduction. |
Strange, it worked this time. Not sure what the issue was last time. I wanted to adopt Kysely in our project, but didn't do it because of this error. I tried a little more times, and it worked all of the time. Don't remember what might have caused the issue last time. Thanks for your comment anyways, since I was able to get it working now, so I can use it in my project then! |
I'm trying to transform the following SQLite statement into the corresponding MySQL expression:
SQLite:
I've replaced
onConflict()
withignore()
and removedreturning()
, as both of them aren't supported by the MySQL dialect. So now I haveMySQL:
My understanding is that
insert.insertId
should be the id of the inserted entry, but it isundefined
.Is there another way to retrieve the ID of the inserted entry? Re-querying it directly after the insertion is quite cumbersome.
Further details:
I'm using Prisma and
prisma-kysely
, if this is relevant here.The
vehiceId
field is defined as follows in theschema.prisma
:PS: Thank you for creating such a nice library 🙌🏼
The text was updated successfully, but these errors were encountered: