Error when updating Record
I just set up prisma postgres and when I try to update a relationship I get the following error.
PostgresError { code: "55000", message: "cannot delete from table \"_LocationToLocationType\" because it does not have a replica identity and publishes deletes", severity: "ERROR", detail: None, column: None, hint: Some("To enable deleting from the table, set REPLICA IDENTITY using ALTER TABLE.")
how to fix this using prisms ORM?
13 Replies
Hi @davidpink
This is a known issue and we are working to provide a fix. I'll provide updates once the fix is rolled out.
great, thank you. Keep me posted
Hi @davidpink
Can you please share the schema file and the migration file as well?
model LocationType {
id String @id @default(cuid())
name String @db.VarChar(255)
slug String @unique
i18nextKey String
icon LocationTypeShort
createdAt DateTime @default(now())
locations Location[]
}
model Location {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
slug String @unique
name String @db.VarChar(255)
ownerId String
owner User @relation(fields: [ownerId], references: [id], onDelete: Restrict)
isVerified Boolean @default(false)
verifiedAt DateTime?
verifiedPlaceId String? @db.VarChar(255)
onboardingCompleted Boolean @default(false)
locationTypes LocationType[]
@@index([slug])
}
there’s no migration file. I tried to update the location types with
locationTypes: locationTypes
? {
set: [],
connect: locationTypes?.map((locationType) => ({
id: locationType,
})),
}
: undefined,
What does the model for
LocationTypeShort
look like?enum LocationTypeShort {
studio
shop
retreat
school
}
Thank you, I've shared it with the team for investigation.
any updates on this one yet?
We have identified the root cause and have prioritize this issue. I'll provide an update once the fix is rolled out by the engineering team.
Hi @davidpink
With the release of Prisma 6 yesterday, this issue was fixed. Can you please try and see that this si resolved for you. You can learn more about the fix here
GitHub
Release 6.0.0 · prisma/prisma
We’re excited to share the Prisma ORM v6 release today 🎉
As this is a major release, it includes a few breaking changes that may affect your application. Before upgrading, we recommend that you che...
awesome thank you!
it’s working as expected now. thank you!
You’re welcome 🎉