admin管理员组文章数量:1302273
I am currently working on a project where I use express with Prisma with Postgres db but I have recently ran into same error over and over again
ConnectorError(ConnectorError { user_facing_error: None, kind: QueryError(PostgresError { code: "42P05", message: "prepared statement \s0\ already exists", severity: "ERROR", detail: None, column: None, hint: None }), transient: false })
How can I fix this?
const user = await prisma.$transaction(async (tx) => {
return await tx.user.findFirst({
where: { email },
select: {
id: true,
email: true,
password: true,
username: true,
role: true,
refreshToken: true
}
});
});
import { PrismaClient } from '@prisma/client'
const globalForPrisma = globalThis as unknown as {
prisma: PrismaClient | undefined
}
export const prisma = globalForPrisma.prisma ?? new PrismaClient()
if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
directUrl = env("DIRECT_URL")
}
enum Role {
ADMIN
USER
}
model User{
id String @id @default(uuid())
username String @unique
password String
role Role @default(USER)
isVerified Boolean @default(false)
refreshToken String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
email String @unique
}
本文标签: postgresqlGetting 42P05 when trying to finUnique using prisma ormStack Overflow
版权声明:本文标题:postgresql - Getting 42P05 when trying to finUnique using prisma orm - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741674301a2391788.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论