Description
Bug description
Raw SELECT query returns BigInt IDs instead of Int which (again) crashes my app unexpectedly and unpredictably.
We should stop this BigInt hell once and forever.
How to reproduce
See schema and code samples below.
Expected behavior
Since I declared ID as unsigned integer I'd like to see integer in the result set (and not BigInt).
Prisma information
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
model Tag {
id Int @id @default(autoincrement()) @db.UnsignedInt
name String @unique
@@map("tags")
}
1) Correct case
const = await prisma.tag.findMany();
Returns IDs as Int (as declared in the schema):
[
{
id: 1,
name: 'united states of america',
}
]
2) Erroneous case
const tags = await prisma.$queryRawUnsafe(`select id, name from tags`)
Returns IDs as BigInt:
[
{
id: 1n,
name: 'united states of america',
}
]
Environment & setup
- OS: Ubunu 22.04
- Database: mariadb:10.7.5 (Docker)
- Node.js version: node:16-alpine (Docker)
Prisma Version
The latest working version is 4.3.1.
It breaks starting from 4.4.0 and above including the latest one.