prisma: Unable to use dbgenerated uuid_to_bin for ID field: "Could not figure out an ID in create"
Hi Team,
I am facing an issue where I am unable to use dbgenerated for mysql8 function uuid_to_bin to associate with my default id . I am getting error as below. I have attached my schema and probably other related details that might be required. Let me know if i am doing this wrong , i did not find anything relevant in documentation that can help.
PANIC in query-engine/connectors/sql-query-connector/src/database/operations/write.rs:73:22
Could not figure out an ID in create
This is a non-recoverable error which probably happens when the Prisma Query Engine has a panic.
Versions
| Name | Version |
|---|---|
| Node | v14.16.0 |
| OS | rhel-openssl-1.1.x |
| Prisma Client | 2.22.1 |
| Query Engine | query-engine 60cc71d884972ab4e897f0277c4b84383dddaf6c |
| Database | undefined |
Schema
model User {
id Bytes @id @db.Binary(16) @default(dbgenerated("(uuid_to_bin(uuid()))"))
email String @unique @db.VarChar(320)
name String?
contact String @db.VarChar(15)
}
Query
mutation {
createOneUser(data: {
name: "X"
email: "X"
contact: "X"
}) {
id
email
name
contact
}
}
Logs
prisma:tryLoadEnv Environment variables loaded from /home/xxx/xxx/prisma-test/.env
prisma:tryLoadEnv Environment variables loaded from /home/xxx/xxxt/.env
prisma:client clientVersion: 2.22.1
prisma:engine { cwd: '/home/xxx/xxx/prisma-test/prisma' }
prisma:engine Search for Query Engine in /home/xxx/xxx//prisma-test/node_modules/.prisma/client
prisma:engine Search for Query Engine in /home/xxx/xxx//prisma-test/node_modules/.prisma/client
plusX Execution permissions of /home/xxx/xxx/prisma-test/node_modules/.prisma/client/query-engine-rhel-openssl-1.1.x are fine
prisma:engine { flags: [ '--enable-raw-queries', '--port', '43487' ] }
plusX Execution permissions of /home/xxx/xxx//prisma-test/node_modules/.prisma/client/query-engine-rhel-openssl-1.1.x are fine
prisma:engin
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 15 (7 by maintainers)
Commits related to this issue
- Support Uuid_to_bin in MySQL MySQL is the only main used database returning Uuid as a string, so they created an additional function, uuid_to_bin, to convert the string value to binary. This is a "fe... — committed to prisma/quaint by cprieto 2 years ago
- Add support for native uuid in MySQL - This is part of https://github.com/prisma/prisma/issues/7010 - Made cargo fmt happy - Made @Weakky happy - Integration tests for both functions — committed to prisma/quaint by cprieto 2 years ago
- Support Uuid_to_bin and uuid in MySQL (#346) MySQL is the only main used database returning Uuid as a string, so they created an additional function, uuid_to_bin, to convert the string value to binar... — committed to prisma/quaint by cprieto 2 years ago
- Support `dbgenerated` with `(uuid())` and `(uuid_to_bin(uuid()))` as primary keys - This closes https://github.com/prisma/prisma/issues/7010 - The function `(uuid())` works with any MySQL version ... — committed to prisma/prisma-engines by cprieto 2 years ago
- Support `(uuid())` and `(uuid_to_bin(uuid()))` as primary keys (#2643) Support `dbgenerated` with `(uuid())` and `(uuid_to_bin(uuid()))` as primary keys - This closes https://github.com/prisma/pr... — committed to prisma/prisma-engines by cprieto 2 years ago
@janpio can confirm it works using the dev packages: