Prisma ConversionError 无法将整数值“6484250528”装入 INT4

问题描述 投票:0回答:1

我尝试使用

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} })
node.js typescript postgresql prisma
1个回答
0
投票

没错,但不合适。使用 bigint

© www.soinside.com 2019 - 2024. All rights reserved.