Issue with many to many relations
Bug description
"Error starting Prisma Client":{
"type":"PrismaClientKnownRequestError",
"code":"P1012",
"message":"Get DMMF: Schema parsing - Error while interacting with query-engine-node-api library\nError code: P1012\nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:435\n | \n434 | notifications Notification[]\n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:436\n | \n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:437\n | \n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:438\n | \n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:439\n | \n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:440\n | \n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n441 | experienceCategories ExperienceCategory[]\n | \n\nValidation Error Count: 6\n\nPrisma CLI Version : 4.2.1",
"stack":"Error: Get DMMF: Schema parsing - Error while interacting with query-engine-node-api library\nError code: P1012\nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:435\n | \n434 | notifications Notification[]\n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:436\n | \n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:437\n | \n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:438\n | \n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:439\n | \n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:440\n | \n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n441 | experienceCategories ExperienceCategory[]\n | \n\nValidation Error Count: 6\n\nPrisma CLI Version : 4.2.1\n at /var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:137:14\n at /var/task/node_modules/.pnpm/[email protected]/node_modules/fp-ts/lib/Either.js:268:52\n at pipe (/var/task/node_modules/.pnpm/[email protected]/node_modules/fp-ts/lib/function.js:288:23)\n at /var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:126:50\n at n.e.run (/var/task/node_modules/.pnpm/[email protected]/node_modules/ts-pattern/dist/index.cjs:1:4927)\n at n.e.otherwise (/var/task/node_modules/.pnpm/[email protected]/node_modules/ts-pattern/dist/index.cjs:1:4570)\n at getDmmfNodeAPI (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:145:6)\n at async getDMMF (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:64:16)"
}"Error":"Error starting Prisma Client":{
"type":"PrismaClientKnownRequestError",
"code":"P1012",
"message":"Get DMMF: Schema parsing - Error while interacting with query-engine-node-api library\nError code: P1012\nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:435\n | \n434 | notifications Notification[]\n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:436\n | \n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:437\n | \n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:438\n | \n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:439\n | \n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:440\n | \n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n441 | experienceCategories ExperienceCategory[]\n | \n\nValidation Error Count: 6\n\nPrisma CLI Version : 4.2.1",
"stack":"Error: Get DMMF: Schema parsing - Error while interacting with query-engine-node-api library\nError code: P1012\nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:435\n | \n434 | notifications Notification[]\n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:436\n | \n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:437\n | \n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:438\n | \n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:439\n | \n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:440\n | \n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n441 | experienceCategories ExperienceCategory[]\n | \n\nValidation Error Count: 6\n\nPrisma CLI Version : 4.2.1\n at /var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:137:14\n at /var/task/node_modules/.pnpm/[email protected]/node_modules/fp-ts/lib/Either.js:268:52\n at pipe (/var/task/node_modules/.pnpm/[email protected]/node_modules/fp-ts/lib/function.js:288:23)\n at /var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:126:50\n at n.e.run (/var/task/node_modules/.pnpm/[email protected]/node_modules/ts-pattern/dist/index.cjs:1:4927)\n at n.e.otherwise (/var/task/node_modules/.pnpm/[email protected]/node_modules/ts-pattern/dist/index.cjs:1:4570)\n at getDmmfNodeAPI (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:145:6)\n at async getDMMF (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:64:16)"
}"at Hs.init (https"::"1":81543)
My schema:
notifications Notification[]
friends User[] @relation("UserFriends")
friendsOf User[] @relation("UserFriends")
invited User[] @relation("UserInvites")
invitedBy User[] @relation("UserInvites")
blocked User[] @relation("UserBlocked")
blockedBy User[] @relation("UserBlocked")
experienceCategories ExperienceCategory[]
I think it is telling me to remove the @relation, but if I do that, and I have many many-to-many connects of the same data type to itself, how will it know which one to connect to?
Strangely, I can run Prisma Studio fine locally, just the cloud version throws this error.
How to reproduce
Expected behavior
Cloud version of prisma data browser works like local version?
Prisma information
<!-- Do not include your database credentials when sharing your Prisma schema! -->
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
binaryTargets = ["native"]
previewFeatures = ["fullTextSearch"]
}
model AppMetadata {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
latestBuild Int?
lastSupportedBuild Int?
}
model AudioFile {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
url String @unique
streamType StreamType? @default(default)
userAgent String?
contentType String?
duration Int?
pitchAlgorithm PitchAlgorithm?
headers Json?
experienceId String?
background Background[]
soundtrack Soundtrack? @relation(fields: [soundtrackId], references: [id])
soundtrackId String?
signal Signal? @relation(fields: [signalId], references: [id])
signalId String?
plays Play[]
Experience Experience? @relation(fields: [experienceId], references: [id])
@@index([experienceId], name: "AudioFile.experienceId_index")
}
model Chat {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
chatMessages ChatMessage[]
users User[]
readBy User[] @relation("Chat_ReadBy_User")
}
model ChatMessage {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
message String?
chatId String
sentById String
chat Chat @relation(fields: [chatId], references: [id])
sentBy User @relation(fields: [sentById], references: [id])
notification Notification? @relation("Notification_About_Message")
userExperienceRecommendationId String?
userExperienceRecommendation UserExperienceRecommendation? @relation(fields: [userExperienceRecommendationId], references: [id])
userSharedEntryId String?
userSharedEntry UserSharedEntry? @relation(fields: [userSharedEntryId], references: [id])
}
model Event {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime? @updatedAt
coverPhotoUrl String?
endDate DateTime?
description String?
isFullDay Boolean?
isRecurring Boolean?
locationDetails String?
locationType EventLocationType?
name String
parentEventId String?
startDate DateTime?
visibility EventVisibility?
groupId String?
group Group? @relation("Event_BelongsTo_Group", fields: [groupId], references: [id])
creatorId String?
creator User? @relation("Event_BelongsTo_User", fields: [creatorId], references: [id])
attendees EventAttendee[] @relation("EventAttendee_BelongsTo_Event")
experiences Experience[]
recurringPatternId String?
recurringPattern EventRecurringPattern? @relation("EventRecurringPattern_BelongsTo_Event")
featured Boolean @default(false)
notifications Notification[] @relation("Notification_About_Event")
}
model EventRecurringPattern {
id String @id @default(cuid())
eventId String? @unique
event Event? @relation("EventRecurringPattern_BelongsTo_Event", fields: [eventId], references: [id])
recurringType EventRecurringType
maxNumOccurences Int?
separationCount Int?
daysOfWeek DayOfWeek[]
}
model EventAttendee {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime? @updatedAt
status EventAttendeeStatus
eventId String
attendeeId String
invitedById String?
attendee User @relation("EventAttendee_BelongsTo_User", fields: [attendeeId], references: [id])
event Event @relation("EventAttendee_BelongsTo_Event", fields: [eventId], references: [id])
invitedBy User? @relation("EventAttendee_InvitedBy_User", fields: [invitedById], references: [id])
@@unique([attendeeId, eventId])
}
model Experience {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String
artist String
album String?
description String?
genre String?
date DateTime?
booleanRating Boolean?
starRating Int?
artwork String?
guided Boolean?
background Background[]
status ExperienceStatus?
groupId String?
guideId String?
numberOfRatings Int?
ratingValue Int?
recommendedInGroups GroupExperienceRecommendation[] @relation(name: "Experience_RecommendedTo_Group")
recommendedToUser UserExperienceRecommendation[] @relation(name: "Experience_RecommendedTo_User")
guide Guide? @relation(fields: [guideId], references: [id])
audios AudioFile[]
journalEntries JournalEntry[]
journeys JourneyExperience[]
plays Play[]
ratings Rating[]
events Event[]
categories ExperienceCategory[]
likedBy User[] @relation("Experience_LikedBy_User")
sortOrder Int?
}
model ExperienceCategory {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
title String
iconName String
iconSet String?
imageUrl String
order Int?
followers User[]
experiences Experience[]
}
model File {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
name String?
fileName String
size Int?
fileType String?
url String
}
model Group {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String
description String?
coverImage String?
welcomeMessage String?
guidelines String?
visibility GroupVisibility
events Event[] @relation("Event_BelongsTo_Group")
members GroupMember[] @relation("GroupMember_BelongsTo_Group")
posts Post[]
featured Boolean @default(false)
official Boolean @default(false)
recommendedExperiences GroupExperienceRecommendation[] @relation(name: "Group_RelatedTo_Experience_Recommendation")
sharedEntries GroupSharedEntry[] @relation("Group_RelatedTo_SharedEntry")
issues Issue[] @relation("Issue_About_Group")
Notification Notification[] @relation("Notification_About_Group")
}
model GroupExperienceRecommendation {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
experience Experience @relation(name: "Experience_RecommendedTo_Group", fields: [experienceId], references: [id])
experienceId String
group Group @relation(name: "Group_RelatedTo_Experience_Recommendation", fields: [groupId], references: [id])
groupId String
recommendedBy User[] @relation(name: "GroupExperience_RecommendedBy_User")
Post Post[]
}
model GroupSharedEntry {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
entry JournalEntry @relation(name: "JournalEntry_SharedWith_Group", fields: [entryId], references: [id])
entryId String
group Group @relation(name: "Group_RelatedTo_SharedEntry", fields: [groupId], references: [id])
groupId String
Post Post[]
}
model GroupMember {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
status GroupMemberStatus
groupId String
memberId String
recommendedById String?
group Group @relation("GroupMember_BelongsTo_Group", fields: [groupId], references: [id])
member User @relation("GroupMember_BelongsTo_User", fields: [memberId], references: [id])
recommendedBy User? @relation("GroupMember_RecommendedBy_User", fields: [recommendedById], references: [id])
newMessageNotifications Boolean? @default(true)
recommendationsNotifications Boolean? @default(true)
groupEventsNotifications Boolean? @default(true)
@@unique([memberId, groupId])
}
model Guide {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
firstName String
lastName String
description String
avatarUrl String
gender Gender?
experiences Experience[]
}
model Issue {
id String @id @default(cuid())
createdAt DateTime @default(now())
comments String?
issueType IssueType
userId String?
user User? @relation("Issue_About_User", fields: [userId], references: [id])
postId String?
post Post? @relation("Issue_About_Post", fields: [postId], references: [id])
commentId String?
comment PostComment? @relation("Issue_About_PostComment", fields: [commentId], references: [id])
groupId String?
group Group? @relation("Issue_About_Group", fields: [groupId], references: [id])
reporterId String
reportedBy User @relation("Issue_ReportedBy_User", fields: [reporterId], references: [id])
}
model JournalEntry {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String?
content String
userId String
experienceId String?
experience Experience? @relation(fields: [experienceId], references: [id])
creator User @relation(fields: [userId], references: [id])
tags JournalTag[]
userSharedEntries UserSharedEntry[] @relation("JournalEntry_SharedWith_User")
groupSharedEntries GroupSharedEntry[] @relation("JournalEntry_SharedWith_Group")
visibility JournalEntryVisibility?
@@index([userId], name: "JournalEntry.userId_index")
}
model JournalTag {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
entries JournalEntry[]
users User[]
}
model Journey {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String
description String?
experiences JourneyExperience[]
members User[]
}
model JourneyExperience {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
journeyId String
experienceId String
order Int
experience Experience @relation(fields: [experienceId], references: [id])
journey Journey @relation(fields: [journeyId], references: [id])
userProgress JourneyProgress[]
}
model JourneyProgress {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
experienceId String
userId String
experience JourneyExperience @relation(fields: [experienceId], references: [id])
user User @relation(fields: [userId], references: [id])
}
model Notification {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
notificationType NotificationType
isRead Boolean?
messageId String? @unique
message ChatMessage? @relation("Notification_About_Message", fields: [messageId], references: [id])
friendId String?
friend User? @relation("Notification_About_Friend", fields: [friendId], references: [id])
postId String?
post Post? @relation("Notification_About_Post", fields: [postId], references: [id])
commentId String?
comment PostComment? @relation("Notification_About_PostComment", fields: [commentId], references: [id])
groupId String?
group Group? @relation("Notification_About_Group", fields: [groupId], references: [id])
eventId String?
event Event? @relation("Notification_About_Event", fields: [eventId], references: [id])
toId String
to User @relation(fields: [toId], references: [id])
}
model Play {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
audioId String
experienceId String?
signalId String?
soundtrackId String?
userId String
startTime Float @default(0)
endTime Float?
duration Float?
audio AudioFile @relation(fields: [audioId], references: [id])
experience Experience? @relation(fields: [experienceId], references: [id])
signal Signal? @relation(fields: [signalId], references: [id])
soundtrack Soundtrack? @relation(fields: [soundtrackId], references: [id])
user User @relation(fields: [userId], references: [id])
@@index([audioId], name: "Play.audioId_index")
@@index([experienceId], name: "Play.experienceId_index")
@@index([userId], name: "Play.userId_index")
}
model Post {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String?
body String?
authorId String
groupId String
author User @relation(fields: [authorId], references: [id])
group Group @relation(fields: [groupId], references: [id])
likedBy User[] @relation(name: "Post_LikedBy_User")
comments PostComment[]
notifications Notification[] @relation("Notification_About_Post")
groupExperienceRecommendationId String?
groupExperienceRecommendation GroupExperienceRecommendation? @relation(fields: [groupExperienceRecommendationId], references: [id])
groupSharedEntryId String?
groupSharedEntry GroupSharedEntry? @relation(fields: [groupSharedEntryId], references: [id])
issue Issue[] @relation("Issue_About_Post")
isEdited Boolean? @default(false)
}
model PostComment {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
comment String
authorId String
postId String
author User @relation(fields: [authorId], references: [id])
post Post @relation(fields: [postId], references: [id])
notifications Notification[] @relation("Notification_About_PostComment")
issues Issue[] @relation("Issue_About_PostComment")
isEdited Boolean? @default(false)
}
model Rating {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
userId String
experienceId String
value Int
experience Experience @relation(fields: [experienceId], references: [id])
user User @relation(fields: [userId], references: [id])
@@index([experienceId], name: "Rating.experienceId_index")
@@index([userId], name: "Rating.userId_index")
}
model Signal {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
title String
artwork String?
status ExperienceStatus?
audios AudioFile[]
sortOrder Int?
plays Play[]
}
model Soundtrack {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
title String
icon String?
iconSet String?
audios AudioFile[]
sortOrder Int?
plays Play[]
}
model User {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @default(now()) @updatedAt
role Role
developer Boolean @default(false)
email String @unique
username String @unique
password String?
passwordResetToken String?
passwordResetExpires DateTime?
firstName String?
lastName String?
bio String?
avatarUrl String?
coverPhotoUrl String?
phone String?
isSetUp Boolean @default(false)
location String?
private Boolean @default(true)
journalEntries JournalEntry[]
groups GroupMember[] @relation("GroupMember_BelongsTo_User")
groupRecommendations GroupMember[] @relation(name: "GroupMember_RecommendedBy_User")
ExperienceRecommendationsToGroup GroupExperienceRecommendation[] @relation(name: "GroupExperience_RecommendedBy_User")
ExperienceRecommendationsToUser UserExperienceRecommendation[] @relation(name: "UserExperience_RecommendedBy_User")
recommendedExperiences UserExperienceRecommendation[] @relation(name: "User_RelatedTo_Experience_Recommendation")
events EventAttendee[] @relation("EventAttendee_BelongsTo_User")
eventInvites EventAttendee[] @relation("EventAttendee_InvitedBy_User")
posts Post[]
postComment PostComment[]
chats Chat[]
chatMessages ChatMessage[]
notifications Notification[]
friends User[] @relation("UserFriends")
friendsOf User[] @relation("UserFriends")
invited User[] @relation("UserInvites")
invitedBy User[] @relation("UserInvites")
blocked User[] @relation("UserBlocked")
blockedBy User[] @relation("UserBlocked")
experienceCategories ExperienceCategory[]
plays Play[]
favorites Experience[] @relation("Experience_LikedBy_User")
hidePreFlight Boolean @default(false)
journeys Journey[]
journeyProgress JourneyProgress[]
ratings Rating[]
tags JournalTag[]
likedGroupPosts Post[] @relation(name: "Post_LikedBy_User")
currentStreak Int?
highStreak Int?
streakLastRecorded DateTime?
readChats Chat[] @relation("Chat_ReadBy_User")
notificationsAbout Notification[] @relation("Notification_About_Friend")
Event Event[] @relation("Event_BelongsTo_User")
sharedEntries UserSharedEntry[] @relation("User_RelatedTo_SharedEntry")
issues Issue[] @relation("Issue_About_User")
reportedIssues Issue[] @relation("Issue_ReportedBy_User")
os String?
}
model UserExperienceRecommendation {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
experience Experience @relation(name: "Experience_RecommendedTo_User", fields: [experienceId], references: [id])
experienceId String
user User @relation(name: "User_RelatedTo_Experience_Recommendation", fields: [userId], references: [id])
userId String
recommendedBy User[] @relation(name: "UserExperience_RecommendedBy_User")
ChatMessage ChatMessage[]
}
model UserSharedEntry {
id String @id @default(cuid())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
entry JournalEntry @relation(name: "JournalEntry_SharedWith_User", fields: [entryId], references: [id])
entryId String
user User @relation(name: "User_RelatedTo_SharedEntry", fields: [userId], references: [id])
userId String
ChatMessage ChatMessage[]
}
enum Background {
Music
PinkNoise
Nature
Toning
}
enum DayOfWeek {
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
}
enum EventAttendeeStatus {
None
Admin
Attending
Maybe
Declined
InvitePending
}
enum EventLocationType {
inPerson
Virtual
}
enum EventRecurringType {
Daily
Weekly
Monthly
Yearly
}
enum EventVisibility {
public
private
deleted
}
enum ExperienceStatus {
Public
Private
Beta
Hidden
}
enum Gender {
Male
Female
}
enum GroupMemberStatus {
Admin
InvitePending
RequestPending
Recommended
Active
Banned
}
enum GroupVisibility {
public
private
deleted
}
enum JournalEntryVisibility {
private
shared
deleted
}
enum NotificationType {
newMessage
newPost
newPostComment
friendRequest
friendRequestAccepted
groupInvite
newGroupEvent
newGroupEventInvite
}
enum IssueType {
User
Post
PostComment
Group
}
enum PitchAlgorithm {
PITCH_ALGORITHM_LINEAR
PITCH_ALGORITHM_MUSIC
PITCH_ALGORITHM_VOICE
}
enum Role {
Admin
User
Beta
UserBeta
}
enum StreamType {
dash
hls
smoothstreaming
default
}
Environment & setup
- Link to Data Browser instance: (https://cloud.prisma.io/justinhandley/tmi-nx-stack/staging/databrowser)
- OS: MacOS
- Browser: Chrmoe
- Database: PostgreSQL
Screenshot of page where the problem happened (if applicable)
No response
Prisma logs
Studio version 0.470.0
index.js:1 Error: Error starting Prisma Client: {
"type": "PrismaClientKnownRequestError",
"code": "P1012",
"message": "Get DMMF: Schema parsing - Error while interacting with query-engine-node-api library\nError code: P1012\nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:435\n | \n434 | notifications Notification[]\n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:436\n | \n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:437\n | \n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:438\n | \n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:439\n | \n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:440\n | \n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n441 | experienceCategories ExperienceCategory[]\n | \n\nValidation Error Count: 6\n\nPrisma CLI Version : 4.2.1",
"stack": "Error: Get DMMF: Schema parsing - Error while interacting with query-engine-node-api library\nError code: P1012\nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:435\n | \n434 | notifications Notification[]\n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:436\n | \n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:437\n | \n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:438\n | \n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:439\n | \n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:440\n | \n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n441 | experienceCategories ExperienceCategory[]\n | \n\nValidation Error Count: 6\n\nPrisma CLI Version : 4.2.1\n at /var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:137:14\n at /var/task/node_modules/.pnpm/[email protected]/node_modules/fp-ts/lib/Either.js:268:52\n at pipe (/var/task/node_modules/.pnpm/[email protected]/node_modules/fp-ts/lib/function.js:288:23)\n at /var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:126:50\n at n.e.run (/var/task/node_modules/.pnpm/[email protected]/node_modules/ts-pattern/dist/index.cjs:1:4927)\n at n.e.otherwise (/var/task/node_modules/.pnpm/[email protected]/node_modules/ts-pattern/dist/index.cjs:1:4570)\n at getDmmfNodeAPI (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:145:6)\n at async getDMMF (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:64:16)"
}
at Hs.init (index.js:1:81543)
init @ index.js:1
index.js:1 [BootstrapStore.init] Studio bootstrap failed Object
B @ index.js:1
index.js:1 Error: Error starting Prisma Client: {
"type": "PrismaClientKnownRequestError",
"code": "P1012",
"message": "Get DMMF: Schema parsing - Error while interacting with query-engine-node-api library\nError code: P1012\nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:435\n | \n434 | notifications Notification[]\n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:436\n | \n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:437\n | \n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:438\n | \n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:439\n | \n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:440\n | \n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n441 | experienceCategories ExperienceCategory[]\n | \n\nValidation Error Count: 6\n\nPrisma CLI Version : 4.2.1",
"stack": "Error: Get DMMF: Schema parsing - Error while interacting with query-engine-node-api library\nError code: P1012\nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:435\n | \n434 | notifications Notification[]\n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:436\n | \n435 | friends User[] @relation(\"UserFriends\", references: [id])\n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:437\n | \n436 | friendsOf User[] @relation(\"UserFriends\", references: [id])\n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:438\n | \n437 | invited User[] @relation(\"UserInvites\", references: [id])\n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:439\n | \n438 | invitedBy User[] @relation(\"UserInvites\", references: [id])\n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n | \nerror: Error parsing attribute \"@relation\": Implicit many-to-many relation should not have references argument defined. Either remove it, or change the relation to one-to-many.\n --> schema.prisma:440\n | \n439 | blocked User[] @relation(\"UserBlocked\", references: [id])\n440 | blockedBy User[] @relation(\"UserBlocked\", references: [id])\n441 | experienceCategories ExperienceCategory[]\n | \n\nValidation Error Count: 6\n\nPrisma CLI Version : 4.2.1\n at /var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:137:14\n at /var/task/node_modules/.pnpm/[email protected]/node_modules/fp-ts/lib/Either.js:268:52\n at pipe (/var/task/node_modules/.pnpm/[email protected]/node_modules/fp-ts/lib/function.js:288:23)\n at /var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:126:50\n at n.e.run (/var/task/node_modules/.pnpm/[email protected]/node_modules/ts-pattern/dist/index.cjs:1:4927)\n at n.e.otherwise (/var/task/node_modules/.pnpm/[email protected]/node_modules/ts-pattern/dist/index.cjs:1:4570)\n at getDmmfNodeAPI (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:145:6)\n at async getDMMF (/var/task/node_modules/.pnpm/@[email protected]/node_modules/@prisma/internals/dist/engine-commands/getDmmf.js:64:16)"
}
at Hs.init (index.js:1:81543)
B @ index.js:1
index.js:1 Uncaught (in promise) F
Hey @justinhandley, what Prisma version are you using locally?
3.12.0
On Aug 19, 2022, at 3:54 AM, Petra Donka @.***> wrote:
Hey @justinhandley https://github.com/justinhandley, what Prisma version are you using locally?
— Reply to this email directly, view it on GitHub https://github.com/prisma/studio/issues/1008#issuecomment-1220366242, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEXXRK2ZLVFLHLIOTZHU4DVZ44U7ANCNFSM566LCUGA. You are receiving this because you were mentioned.
Prisma is complaining that you have an implicit relationship (both sides just have [] and no explicit fields in the @relation), but are using references in @relation - which is also not valid any more in newer Prisma versions (but was before 4.x I think). Weird thing is that the schema you posted does not actually have that - but the error message does have snippets from such a schema. Can you check that your Prisma Cloud project indeed is using the same schema you have posted? You should be able to see it online when you log in.
Hi There,
So, this did uncover an internal issue I have to look into which is that our main branch is way behind develop. I’m not building production any more - when I did it was by pushing to Main - seems like that has changed - so sorry about that.
I created a new instance using our develop branch and it did work.
However, it seems like data browser’s default of asking for 100 records is somehow causing a database timeout - if there are only a couple of records it works, but everything with more than 100 records is timing out for me.
Justin
On Aug 19, 2022, at 7:57 PM, Jan Piotrowski @.***> wrote:
Prisma is complaining that you have an implicit relationship (both sides just have [] and no explicit fields in the @relation), but are using references in @relation - which is also not valid any more in newer Prisma versions (but was before 4.x I think). Weird thing is that the schema you posted does not actually have that - but the error message does have snippets from such a schema. Can you check that your Prisma Cloud project indeed is using the same schema you have posted? You should be able to see it online when you log in.
— Reply to this email directly, view it on GitHub https://github.com/prisma/studio/issues/1008#issuecomment-1221178041, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEXXRKTXJWOVAB7DNDBMOTV2ANNRANCNFSM566LCUGA. You are receiving this because you were mentioned.
Thanks for the additional info @justinhandley! Based on your local version (3.12.0) and @janpio's details about the error, I think the issue might be that your schema is not compatible with the latest Prisma version.
You're using 3.12.0 locally, but Data Browser in PDP is trying to parse your schema with the latest Prisma version (4.2.1).
I'd suggest to update to the latest Prisma version to make sure Data Browser can handle the schema you have. You might've done something similar already when using the state of your develop instead of main.
Regarding the performance issues with a larger number of records, I think that might be related to having a large number of relations. Does that seem possible based on the data you know you're trying to work with? If that's the case, we'll be rolling out some improvements early next week, which will hopefully fix the issue for you. If not, we can dig into it more and see what could be going on.
OK, thanks,
Justin
On Aug 21, 2022, at 9:44 AM, Petra Donka @.***> wrote:
Thanks for the additional info @justinhandley https://github.com/justinhandley! Based on your local version (3.12.0) and @janpio https://github.com/janpio's details about the error, I think the issue might be that your schema is not compatible with the latest Prisma version. You're using 3.12.0 locally, but Data Browser in PDP is trying to parse your schema with the latest Prisma version (4.2.1). I'd suggest to update to the latest Prisma version to make sure Data Browser can handle the schema you have. You might've done something similar already when using the state of your develop instead of main.
Regarding the performance issues with a larger number of records, I think that might be related to having a large number of relations. Does that seem possible based on the data you know you're trying to work with? If that's the case, we'll be rolling out some improvements early next week, which will hopefully fix the issue for you. If not, we can dig into it more and see what could be going on.
— Reply to this email directly, view it on GitHub https://github.com/prisma/studio/issues/1008#issuecomment-1221549349, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACEXXRNMEOZPWCYAQMOSMZLV2IXFVANCNFSM566LCUGA. You are receiving this because you were mentioned.