-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Closed
Labels
bug/2-confirmedBug has been reproduced and confirmed.Bug has been reproduced and confirmed.kind/bugA reported bug.A reported bug.topic: @prisma/adapter-pgtopic: driverAdapterstopic: relationJoins
Milestone
Description
Hi all, I've hit an issue when trying out the @prisma/adapter-pg preview feature.
I'm using the latest v5.13.0 and I can resolve the issue by removing the "relationJoins" from the preview features
Here's the error I'm seeing in the console:
20 include: { user: true },
21 };
22
→ 23 const result = await this.#prisma.baseUser.findUnique(
Inconsistent column data: Unexpected conversion failure for field User.intId from Number(1374511782084.0) to BigInt.
at In.handleRequestError (/**/node_modules/@prisma/client/runtime/library.js:122:6854)
at In.handleAndLogRequestError (/**/node_modules/@prisma/client/runtime/library.js:122:6188)
at In.request (/**/node_modules/@prisma/client/runtime/library.js:122:5896)
at l (/**/node_modules/@prisma/client/runtime/library.js:127:11167)
at PrismaUserRepository.getUnsafe (/**/src/infrastructure/repository/v2/prisma/prisma-user.repository.ts:23:24)
Here's roughly how I'm calling Prisma:
async function getUnsafe(id: string | bigint): Promise<User | null> {
const query = {
where: typeof id === 'bigint' ? { intId: id } : { id },
include: { user: true },
};
const result = await prisma.baseUser.findUnique(query);
if (!result) {
return null;
}
return toUser(result);
}
type PrismaBaseUser = Prisma.BaseUserGetPayload<{ include: { user: true } }>;
function toUser(user: PrismaBaseUser): User {
return {
id: user.id,
intId: user.intId,
name: user.user.name,
email: user.user.email,
avatarUrl: user.user.avatar,
};
}Here's a subset of my schema:
generator client {
provider = "prisma-client-js"
previewFeatures = ["relationJoins"]
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
model BaseUser {
id String @id @db.Uuid
intId BigInt @unique
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
favorites Repository[] @relation("UserFavorites")
ownedRepositories Repository[]
user User @relation("userById", fields: [id], references: [id])
userByIntId User @relation("userByIntId", fields: [intId], references: [intId])
// Indexing intId for faster lookups
@@index([intId(ops: Int8BloomOps)], type: Brin)
}
model User {
id String @id @db.Uuid
correlationId String @unique @db.Uuid
intId BigInt @unique
name String
email String?
locale String?
avatar String?
createdAt DateTime @default(now())
updatedAt DateTime
deletedAt DateTime?
baseUser BaseUser? @relation("userById")
baseUserByIntId BaseUser? @relation("userByIntId")
// Indexing intId for faster lookups
@@index([intId(ops: Int8BloomOps)], type: Brin)
// Indexing email for faster lookups
@@index([email], type: Hash)
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug/2-confirmedBug has been reproduced and confirmed.Bug has been reproduced and confirmed.kind/bugA reported bug.A reported bug.topic: @prisma/adapter-pgtopic: driverAdapterstopic: relationJoins