Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous self relation detected #671

Closed
abdusamadtv opened this issue Oct 6, 2019 · 1 comment
Closed

Ambiguous self relation detected #671

abdusamadtv opened this issue Oct 6, 2019 · 1 comment
Labels
bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. kind/bug A reported bug.

Comments

@abdusamadtv
Copy link

prisma2@2.0.0-preview-13.2

I'm running prisma2 lift up and getting

ERROR  Oops, an unexpected error occured!
Error in migration engine: thread 'tokio-runtime-worker-0' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorCollection { errors: [ModelValidationError { message: "Ambiguous self relation detected.", mod 
el_name: "User", span: Span { start: 147, end: 173 } }] }', src\libcore\result.rs:999:5
stack backtrace:

My schema

model User {
  id String @default(cuid()) @id
  username String @unique
  password String
  friends User[]
  conversations Conversation[] @relation(name: "UserConversations")
  messages Message[] @relation(name: "UserMessages")
  sentInvitations Invitation[] @relation(name: "SentInvitations", onDelete: CASCADE)
  receivedInvitations Invitation[] @relation(name: "ReceivedInvitations", onDelete: CASCADE)
}

model Conversation {
  id String @default(cuid()) @id
  members User[] @relation(name: "UserConversations")
  messages Message[] @relation(name: "ConversationMessages")
}

model Message {
  id String @default(cuid()) @id
  message String
  author User @relation(name: "UserMessages")
  conversation Conversation @relation(name: "ConversationMessages")
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}

model Invitation {
  id String @default(cuid()) @id
  from User @relation(name: "SentInvitations")
  to User @relation(name: "ReceivedInvitations")
  status InvitationStatus @default(PENDING)
}

enum InvitationStatus {
  PENDING
  ACCEPTED
  REJECTED
}
@divyenduz
Copy link
Contributor

@AbdusamadTurdiev Do you think that this is a duplicate of #488 (comment)

If yes, please feel free to close this one.

@divyenduz divyenduz added bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. kind/bug A reported bug. labels Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. kind/bug A reported bug.
Projects
None yet
Development

No branches or pull requests

2 participants