我尝试使用
prisma
和 postgresql
进行简单的查询,但是 findUnique
函数抛出以下错误:
Error occurred during query execution:
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(Error { kind: ToSql(0), cause: Some(Error { kind: ConversionError("Unable to fit integer value '6484250528' into an INT4 (32-bit signed integer)."), original_code: None, original_message: None }) }), transient: false })
at In.handleRequestError (/Users/yonghe/Desktop/Projects/Tradex Bot/tradex-bot/node_modules/@prisma/client/runtime/library.js:122:7067)
at In.handleAndLogRequestError (/Users/yonghe/Desktop/Projects/Tradex Bot/tradex-bot/node_modules/@prisma/client/runtime/library.js:122:6211)
at In.request (/Users/yonghe/Desktop/Projects/Tradex Bot/tradex-bot/node_modules/@prisma/client/runtime/library.js:122:5919)
at async l (/Users/yonghe/Desktop/Projects/Tradex Bot/tradex-bot/node_modules/@prisma/client/runtime/library.js:127:11167) {
clientVersion: '5.15.1'
}
架构.prisma
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model User {
id Int @id @default(autoincrement())
userId Int @unique
chatId Int
}
const currentUser = await prisma.user.findUnique({ where: { userId: 6484250528} })
没错,但不合适。使用 bigint。